sm6150-common: udfps: Set fod status based on vendor acquired and cancel

Change-Id: I3477fb7a921555564121e10fc0d710e122dd9d73
This commit is contained in:
Arian 2022-11-14 22:19:33 +01:00
parent bb8d9f4905
commit 5104523fa7

View File

@ -77,10 +77,6 @@ class XiaomiUdfpsHander : public UdfpsHandler {
mDevice->extCmd(mDevice, COMMAND_NIT, mDevice->extCmd(mDevice, COMMAND_NIT,
readBool(fd) ? PARAM_NIT_UDFPS : PARAM_NIT_NONE); readBool(fd) ? PARAM_NIT_UDFPS : PARAM_NIT_NONE);
int arg[2] = {TOUCH_UDFPS_ENABLE,
readBool(fd) ? UDFPS_STATUS_ON : UDFPS_STATUS_OFF};
ioctl(touch_fd_.get(), TOUCH_IOC_SETMODE, &arg);
} }
}).detach(); }).detach();
} }
@ -93,6 +89,25 @@ class XiaomiUdfpsHander : public UdfpsHandler {
// nothing // nothing
} }
void onAcquired(int32_t result, int32_t vendorCode) {
if (result == FINGERPRINT_ACQUIRED_GOOD) {
int arg[2] = {TOUCH_UDFPS_ENABLE, UDFPS_STATUS_OFF};
ioctl(touch_fd_.get(), TOUCH_IOC_SETMODE, &arg);
} else if (vendorCode == 21 || vendorCode == 23) {
/*
* vendorCode = 21 waiting for fingerprint authentication
* vendorCode = 23 waiting for fingerprint enroll
*/
int arg[2] = {TOUCH_UDFPS_ENABLE, UDFPS_STATUS_ON};
ioctl(touch_fd_.get(), TOUCH_IOC_SETMODE, &arg);
}
}
void cancel() {
int arg[2] = {TOUCH_UDFPS_ENABLE, UDFPS_STATUS_OFF};
ioctl(touch_fd_.get(), TOUCH_IOC_SETMODE, &arg);
}
private: private:
fingerprint_device_t* mDevice; fingerprint_device_t* mDevice;
android::base::unique_fd touch_fd_; android::base::unique_fd touch_fd_;