From 9f7ed6cc78817a4021bb74026892dea0ac35cce4 Mon Sep 17 00:00:00 2001 From: LuK1337 Date: Tue, 2 Jul 2019 15:05:43 +0200 Subject: [PATCH] sm8150-common: fod: Implement handleAcquire, handleError() Change-Id: Ica796fbd468e2df0ee666a0d0c6cbde628d6989f --- fod/FingerprintInscreen.cpp | 33 +++++++++++++++++++++++++++++++-- fod/FingerprintInscreen.h | 3 ++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/fod/FingerprintInscreen.cpp b/fod/FingerprintInscreen.cpp index 3c8c96c6..c195519b 100644 --- a/fod/FingerprintInscreen.cpp +++ b/fod/FingerprintInscreen.cpp @@ -21,6 +21,8 @@ #include #include +#define FINGERPRINT_ACQUIRED_VENDOR 6 + #define OP_ENABLE_FP_LONGPRESS 3 #define OP_DISABLE_FP_LONGPRESS 4 #define OP_RESUME_FP_ENROLL 8 @@ -123,8 +125,35 @@ Return FingerprintInscreen::onHideFODView() { return Void(); } -Return FingerprintInscreen::shouldHandleError(int32_t error) { - return error != 8; +Return FingerprintInscreen::handleAcquired(int32_t acquiredInfo, int32_t vendorCode) { + std::lock_guard _lock(mCallbackLock); + if (mCallback == nullptr) { + return false; + } + + if (acquiredInfo == FINGERPRINT_ACQUIRED_VENDOR) { + if (vendorCode == 0) { + Return ret = mCallback->onFingerDown(); + if (!ret.isOk()) { + LOG(ERROR) << "FingerDown() error: " << ret.description(); + } + return true; + } + + if (vendorCode == 1) { + Return ret = mCallback->onFingerUp(); + if (!ret.isOk()) { + LOG(ERROR) << "FingerUp() error: " << ret.description(); + } + return true; + } + } + + return false; +} + +Return FingerprintInscreen::handleError(int32_t, int32_t) { + return false; } Return FingerprintInscreen::setLongPressEnabled(bool enabled) { diff --git a/fod/FingerprintInscreen.h b/fod/FingerprintInscreen.h index 61770844..8ffbc2d5 100644 --- a/fod/FingerprintInscreen.h +++ b/fod/FingerprintInscreen.h @@ -44,7 +44,8 @@ class FingerprintInscreen : public IFingerprintInscreen { Return onRelease() override; Return onShowFODView() override; Return onHideFODView() override; - Return shouldHandleError(int32_t error) override; + Return handleAcquired(int32_t acquiredInfo, int32_t vendorCode) override; + Return handleError(int32_t error, int32_t vendorCode) override; Return setLongPressEnabled(bool enabled) override; Return getDimAmount(int32_t cur_brightness) override; Return shouldBoostBrightness() override;