From 824ed2d19039297d8b8b77a954e632fa4fb5e532 Mon Sep 17 00:00:00 2001 From: LuK1337 Date: Mon, 3 Feb 2020 20:17:27 +0100 Subject: [PATCH] sm8150-common: fod: Don't invoke callbacks when fod circle is not visible Change-Id: Ib5ca18f6f47642a0d77288694f6e906c2901bceb --- fod/FingerprintInscreen.cpp | 8 ++++++-- fod/FingerprintInscreen.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fod/FingerprintInscreen.cpp b/fod/FingerprintInscreen.cpp index 9b986ab4..f90552bd 100644 --- a/fod/FingerprintInscreen.cpp +++ b/fod/FingerprintInscreen.cpp @@ -64,6 +64,7 @@ static T get(const std::string& path, const T& def) { } FingerprintInscreen::FingerprintInscreen() { + this->mFodCircleVisible = false; this->mVendorFpService = IVendorFingerprintExtensions::getService(); this->mVendorDisplayService = IOneplusDisplay::getService(); } @@ -100,10 +101,13 @@ Return FingerprintInscreen::onRelease() { } Return FingerprintInscreen::onShowFODView() { + this->mFodCircleVisible = true; + return Void(); } Return FingerprintInscreen::onHideFODView() { + this->mFodCircleVisible = false; this->mVendorDisplayService->setMode(OP_DISPLAY_AOD_MODE, 0); this->mVendorDisplayService->setMode(OP_DISPLAY_SET_DIM, 0); set(HBM_ENABLE_PATH, 0); @@ -119,7 +123,7 @@ Return FingerprintInscreen::handleAcquired(int32_t acquiredInfo, int32_t v } if (acquiredInfo == FINGERPRINT_ACQUIRED_VENDOR) { - if (vendorCode == 0) { + if (mFodCircleVisible && vendorCode == 0) { Return ret = mCallback->onFingerDown(); if (!ret.isOk()) { LOG(ERROR) << "FingerDown() error: " << ret.description(); @@ -127,7 +131,7 @@ Return FingerprintInscreen::handleAcquired(int32_t acquiredInfo, int32_t v return true; } - if (vendorCode == 1) { + if (mFodCircleVisible && vendorCode == 1) { Return ret = mCallback->onFingerUp(); if (!ret.isOk()) { LOG(ERROR) << "FingerUp() error: " << ret.description(); diff --git a/fod/FingerprintInscreen.h b/fod/FingerprintInscreen.h index 8ffbc2d5..457405c7 100644 --- a/fod/FingerprintInscreen.h +++ b/fod/FingerprintInscreen.h @@ -55,6 +55,8 @@ class FingerprintInscreen : public IFingerprintInscreen { Return getSize() override; private: + bool mFodCircleVisible; + sp mVendorDisplayService; sp mVendorFpService;