From 19cbd7ae08cdeacc34f1915da776437faad414e2 Mon Sep 17 00:00:00 2001 From: Arian Date: Sat, 24 Jun 2023 17:46:03 +0800 Subject: [PATCH] sm8350-common: udfps: Set fod status based on vendor acquired and cancel Change-Id: I8cbabdfd48576a1afdbf9d2c542ed82a11a4874c --- udfps/UdfpsHandler.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/udfps/UdfpsHandler.cpp b/udfps/UdfpsHandler.cpp index 1e84f7b..6015840 100644 --- a/udfps/UdfpsHandler.cpp +++ b/udfps/UdfpsHandler.cpp @@ -80,14 +80,7 @@ class XiaomiUdfpsHander : public UdfpsHandler { continue; } - if (readBool(fd)) { - mDevice->extCmd(mDevice, COMMAND_NIT, PARAM_NIT_UDFPS); - set(FOD_STATUS_PATH, FOD_STATUS_ON); - } else { - mDevice->extCmd(mDevice, COMMAND_NIT, PARAM_NIT_NONE); - set(FOD_HBM_PATH, FOD_HBM_OFF); - set(FOD_STATUS_PATH, FOD_STATUS_OFF); - } + mDevice->extCmd(mDevice, COMMAND_NIT, readBool(fd) ? PARAM_NIT_UDFPS : PARAM_NIT_NONE); } }).detach(); } @@ -100,12 +93,22 @@ class XiaomiUdfpsHander : public UdfpsHandler { // nothing } - void onAcquired(int32_t /*result*/, int32_t /*vendorCode*/) { - // nothing + void onAcquired(int32_t result, int32_t vendorCode) { + if (result == FINGERPRINT_ACQUIRED_GOOD) { + set(FOD_HBM_PATH, FOD_HBM_OFF); + set(FOD_STATUS_PATH, FOD_STATUS_OFF); + } else if (vendorCode == 21 || vendorCode == 23) { + /* + * vendorCode = 21 waiting for fingerprint authentication + * vendorCode = 23 waiting for fingerprint enroll + */ + set(FOD_STATUS_PATH, FOD_STATUS_ON); + } } void cancel() { - // nothing + set(FOD_STATUS_PATH, FOD_STATUS_OFF); + set(FOD_HBM_PATH, FOD_HBM_OFF); } private: