taoyao: Syncing to latest sm8350-common changes

This commit is contained in:
Richard Carvalho
2025-07-09 17:45:23 -03:00
parent 2b83d5a3e7
commit ef252257df
4 changed files with 72 additions and 54 deletions

View File

@@ -39,12 +39,6 @@ TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := cortex-a76
# ART
ART_BUILD_TARGET_NDEBUG := true
ART_BUILD_TARGET_DEBUG := false
ART_BUILD_HOST_NDEBUG := true
ART_BUILD_HOST_DEBUG := false
# Audio
AUDIO_FEATURE_ENABLED_EXTENDED_COMPRESS_FORMAT := true
AUDIO_FEATURE_ENABLED_GKI := true

View File

@@ -319,6 +319,9 @@
<!-- PowerOffAlarmService -->
<bool name="config_powerOffAlarmEnabled">true</bool>
<!-- Whether to enable fingerprint unlock when screen turns off on udfps devices -->
<bool name="config_screen_off_udfps_enabled">true</bool>
<!-- If this is true, the screen will come on when you unplug usb/power/whatever. -->
<bool name="config_unplugTurnsOnScreen">true</bool>

View File

@@ -19,12 +19,9 @@ genfscon sysfs /devices/platform/soc/soc:qcom,pmic_glink/soc:qcom,pmic_glink:qco
# Wakeup nodes
genfscon sysfs /devices/platform/goodix_ts.0/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/17300000.qcom,lpass/subsys6/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/17300000.qcom,lpass/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/188101c.qcom,spss/subsys5/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/188101c.qcom,spss/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys8/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/5c00000.qcom,ssc/subsys7/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/5c00000.qcom,ssc/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/890000.qcom,qup_uart/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/984000.i2c/i2c-0/0-0028/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/998000.i2c/i2c-0/0-005a/wakeup u:object_r:sysfs_wakeup:s0
@@ -46,7 +43,6 @@ genfscon sysfs /devices/platform/soc/abb0000.qcom,evass/subsys2/wakeup u:object_
genfscon sysfs /devices/platform/soc/abb0000.qcom,evass/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/b0000000.qcom,cnss-qca6490/subsys10/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/b0000000.qcom,cnss-qca6490/subsys8/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pmk8350@0:pon_pbs@800/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-03/c440000.qcom,spmi:qcom,pm8350b@3:qcom,amoled/wakeup u:object_r:sysfs_wakeup:s0
# note: Labelling /devices/platform/soc/soc:fingerprint_fpc/wakeup relabels the wakeup_enable node
genfscon sysfs /devices/platform/soc/soc:fingerprint_fpc/wakeup/wakeup u:object_r:sysfs_wakeup:s0

View File

@@ -11,9 +11,9 @@
#include <android-base/unique_fd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <fstream>
#include <poll.h>
#include <fstream>
#include <mutex>
#include <thread>
#include "UdfpsHandler.h"
@@ -26,7 +26,12 @@
#define PARAM_NIT_UDFPS 1
#define PARAM_NIT_NONE 0
#define COMMAND_FOD_PRESS_STATUS 1
#define PARAM_FOD_PRESSED 1
#define PARAM_FOD_RELEASED 0
// Touchscreen and HBM
#define TOUCH_DEV_PATH "/dev/xiaomi-touch"
#define DISP_FEATURE_PATH "/dev/mi_display/disp_feature"
#define FOD_STATUS_PATH "/sys/devices/platform/goodix_ts.0/fod_enable"
@@ -65,63 +70,83 @@ struct disp_base displayBasePrimary = {
.disp_id = MI_DISP_PRIMARY,
};
struct disp_event_req displayEventRequest = {
.base = displayBasePrimary,
.type = MI_DISP_EVENT_FOD,
};
class XiaomiUdfpsHandler : public UdfpsHandler {
public:
public:
void init(fingerprint_device_t* device) {
mDevice = device;
dispFeatureFd = android::base::unique_fd(open(DISP_FEATURE_PATH, O_RDWR));
touchUniqueFd = android::base::unique_fd(open(TOUCH_DEV_PATH, O_RDWR));
}
void onFingerDown(uint32_t /*x*/, uint32_t /*y*/, float /*minor*/, float /*major*/) {
LOG(INFO) << __func__;
set(FOD_STATUS_PATH, FOD_STATUS_ON);
setFingerDown(true);
}
if (mAuthSuccess) return;
void onFingerUp() {
LOG(INFO) << __func__;
set(FOD_STATUS_PATH, FOD_STATUS_OFF);
setFingerDown(false);
}
int buf[MAX_BUF_SIZE] = {MI_DISP_PRIMARY, Touch_Fod_Enable, PARAM_FOD_PRESSED};
ioctl(touchUniqueFd.get(), TOUCH_IOC_SET_CUR_VALUE, &buf);
void onAcquired(int32_t result, int32_t vendorCode) {
LOG(INFO) << __func__ << " result: " << result << " vendorCode: " << vendorCode;
if (static_cast<AcquiredInfo>(result) == AcquiredInfo::GOOD) {
onFingerUp();
} else if (vendorCode == 21) {
/*
* vendorCode = 21 waiting for finger
* vendorCode = 22 finger down
* vendorCode = 23 finger up
*/
set(FOD_STATUS_PATH, FOD_STATUS_ON);
}
}
mDevice->extCmd(mDevice, COMMAND_NIT, PARAM_NIT_UDFPS);
void cancel() {
LOG(INFO) << __func__;
set(FOD_STATUS_PATH, FOD_STATUS_OFF);
}
private:
fingerprint_device_t* mDevice;
android::base::unique_fd dispFeatureFd;
void setFingerDown(bool pressed) {
struct disp_feature_req req = {
.base = displayBasePrimary,
.feature_id = DISP_FEATURE_LOCAL_HBM,
.feature_val = pressed ? LOCAL_HBM_NORMAL_WHITE_1000NIT : LOCAL_HBM_OFF_TO_NORMAL,
.feature_val = LOCAL_HBM_NORMAL_WHITE_1000NIT,
};
ioctl(dispFeatureFd.get(), MI_DISP_IOCTL_SET_FEATURE, &req);
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_STATUS, PARAM_FOD_PRESSED);
}
void onFingerUp() {
int buf[MAX_BUF_SIZE] = {MI_DISP_PRIMARY, Touch_Fod_Enable, PARAM_FOD_RELEASED};
ioctl(touchUniqueFd.get(), TOUCH_IOC_SET_CUR_VALUE, &buf);
mDevice->extCmd(mDevice, COMMAND_NIT, PARAM_NIT_NONE);
struct disp_feature_req req = {
.base = displayBasePrimary,
.feature_id = DISP_FEATURE_LOCAL_HBM,
.feature_val = LOCAL_HBM_OFF_TO_NORMAL,
};
ioctl(dispFeatureFd.get(), MI_DISP_IOCTL_SET_FEATURE, &req);
mDevice->extCmd(mDevice, COMMAND_NIT, pressed ? PARAM_NIT_UDFPS : PARAM_NIT_NONE);
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_STATUS, PARAM_FOD_RELEASED);
}
void onAcquired(int32_t result, int32_t /*vendorCode*/) {
switch (static_cast<AcquiredInfo>(result)) {
case AcquiredInfo::GOOD:
case AcquiredInfo::PARTIAL:
case AcquiredInfo::INSUFFICIENT:
case AcquiredInfo::SENSOR_DIRTY:
case AcquiredInfo::TOO_SLOW:
case AcquiredInfo::TOO_FAST:
case AcquiredInfo::TOO_DARK:
case AcquiredInfo::TOO_BRIGHT:
case AcquiredInfo::IMMOBILE:
case AcquiredInfo::LIFT_TOO_SOON:
onFingerUp();
break;
default:
break;
}
}
void onAuthenticationSucceeded() {
mAuthSuccess = true;
onFingerUp();
std::thread([this]() {
std::this_thread::sleep_for(std::chrono::milliseconds(500));
mAuthSuccess = false;
}).detach();
}
void onAuthenticationFailed() { onFingerUp(); }
private:
fingerprint_device_t* mDevice;
bool mAuthSuccess = false;
android::base::unique_fd dispFeatureFd;
android::base::unique_fd touchUniqueFd;
};
static UdfpsHandler* create() {
@@ -133,6 +158,6 @@ static void destroy(UdfpsHandler* handler) {
}
extern "C" UdfpsHandlerFactory UDFPS_HANDLER_FACTORY = {
.create = create,
.destroy = destroy,
.create = create,
.destroy = destroy,
};