sm8150-common: fod: Don't invoke callbacks when fod circle is not visible

Change-Id: Ib5ca18f6f47642a0d77288694f6e906c2901bceb
This commit is contained in:
LuK1337 2020-02-03 20:17:27 +01:00
parent 1413aca145
commit 824ed2d190
2 changed files with 8 additions and 2 deletions

View File

@ -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<void> FingerprintInscreen::onRelease() {
}
Return<void> FingerprintInscreen::onShowFODView() {
this->mFodCircleVisible = true;
return Void();
}
Return<void> 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<bool> FingerprintInscreen::handleAcquired(int32_t acquiredInfo, int32_t v
}
if (acquiredInfo == FINGERPRINT_ACQUIRED_VENDOR) {
if (vendorCode == 0) {
if (mFodCircleVisible && vendorCode == 0) {
Return<void> ret = mCallback->onFingerDown();
if (!ret.isOk()) {
LOG(ERROR) << "FingerDown() error: " << ret.description();
@ -127,7 +131,7 @@ Return<bool> FingerprintInscreen::handleAcquired(int32_t acquiredInfo, int32_t v
return true;
}
if (vendorCode == 1) {
if (mFodCircleVisible && vendorCode == 1) {
Return<void> ret = mCallback->onFingerUp();
if (!ret.isOk()) {
LOG(ERROR) << "FingerUp() error: " << ret.description();

View File

@ -55,6 +55,8 @@ class FingerprintInscreen : public IFingerprintInscreen {
Return<int32_t> getSize() override;
private:
bool mFodCircleVisible;
sp<IOneplusDisplay> mVendorDisplayService;
sp<IVendorFingerprintExtensions> mVendorFpService;