sm8450-common: udfps: Enable fod_status on finger down events instead for fpc_fod

Unfortunately, the fpc_fod hwmodule does not send vendor messages
when it starts to wait for fingerprints reliably...

Change-Id: Ie66cbed024ce89092ecbb1bd9c965b35c59199f7
This commit is contained in:
kxxt 2024-03-15 08:13:52 +08:00 committed by Arian
parent a69ce12bcc
commit 705b60c599

View file

@ -7,6 +7,7 @@
#define LOG_TAG "UdfpsHandler.xiaomi_sm8450"
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/unique_fd.h>
#include <poll.h>
@ -95,6 +96,10 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
touch_fd_ = android::base::unique_fd(open(TOUCH_DEV_PATH, O_RDWR));
disp_fd_ = android::base::unique_fd(open(DISP_FEATURE_PATH, O_RDWR));
std::string fpVendor = android::base::GetProperty("persist.vendor.sys.fp.vendor", "none");
LOG(DEBUG) << __func__ << "fingerprint vendor is: " << fpVendor;
isFpcFod = fpVendor == "fpc_fod";
// Thread to notify fingeprint hwmodule about fod presses
std::thread([this]() {
int fd = open(FOD_PRESS_STATUS_PATH, O_RDONLY);
@ -207,6 +212,15 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
lastPressX = x;
lastPressY = y;
/*
* On fpc_fod devices, the waiting for finger message is not reliably sent...
* The finger down message is only reliably sent when the screen is turned off, so enable
* fod_status better late than never.
*/
if (isFpcFod) {
setFodStatus(FOD_STATUS_ON);
}
// Ensure touchscreen is aware of the press state, ideally this is not needed
setFingerDown(true);
}
@ -232,12 +246,17 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
}
}
/* vendorCode
/* vendorCode for goodix_fod devices:
* 21: waiting for finger
* 22: finger down
* 23: finger up
* On fpc_fod devices, the waiting for finger message is not reliably sent...
* The finger down message is only reliably sent when the screen is turned off, so enable
* fod_status better late than never.
*/
if (vendorCode == 21) {
if (!isFpcFod && vendorCode == 21) {
setFodStatus(FOD_STATUS_ON);
} else if (isFpcFod && vendorCode == 22) {
setFodStatus(FOD_STATUS_ON);
}
}
@ -270,6 +289,7 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
fingerprint_device_t* mDevice;
android::base::unique_fd touch_fd_;
android::base::unique_fd disp_fd_;
bool isFpcFod;
bool enrolling = false;
uint32_t lastPressX, lastPressY;