sm8250-common: fod: Properly set dim

Matches the behavior of stock rom

Co-authored-by: Hikari-no-Tenshi <kyryljan.serhij@gmail.com>
Signed-off-by: alk3pInjection <webmaster@raspii.tech>
Signed-off-by: Omkar Chandorkar <gotenksIN@aosip.dev>
Change-Id: I76566f0cf427dcf858fae222e71090ed82eeb710
This commit is contained in:
alk3pInjection 2021-05-14 14:05:26 +08:00 committed by Łukasz Patron
parent 2a0985f372
commit e57d3a223a
2 changed files with 2 additions and 24 deletions

View file

@ -21,7 +21,6 @@
#include <hidl/HidlTransportSupport.h>
#include <fstream>
#define FINGERPRINT_ERROR_CANCELED 5
#define FINGERPRINT_ACQUIRED_VENDOR 6
#define FINGERPRINT_ERROR_VENDOR 8
@ -62,13 +61,11 @@ static T get(const std::string& path, const T& def) {
FingerprintInscreen::FingerprintInscreen() {
this->mFodCircleVisible = false;
this->mIsEnrolling = false;
this->mVendorFpService = IVendorFingerprintExtensions::getService();
this->mVendorDisplayService = IOneplusDisplay::getService();
}
Return<void> FingerprintInscreen::onStartEnroll() {
this->mIsEnrolling = true;
this->mVendorFpService->updateStatus(OP_DISABLE_FP_LONGPRESS);
this->mVendorFpService->updateStatus(OP_RESUME_FP_ENROLL);
@ -76,23 +73,18 @@ Return<void> FingerprintInscreen::onStartEnroll() {
}
Return<void> FingerprintInscreen::onFinishEnroll() {
this->mIsEnrolling = false;
this->mVendorFpService->updateStatus(OP_FINISH_FP_ENROLL);
return Void();
}
Return<void> FingerprintInscreen::onPress() {
if (mIsEnrolling) {
this->mVendorDisplayService->setMode(OP_DISPLAY_SET_DIM, 1);
}
this->mVendorDisplayService->setMode(OP_DISPLAY_NOTIFY_PRESS, 1);
return Void();
}
Return<void> FingerprintInscreen::onRelease() {
this->mVendorDisplayService->setMode(OP_DISPLAY_SET_DIM, 0);
this->mVendorDisplayService->setMode(OP_DISPLAY_NOTIFY_PRESS, 0);
return Void();
@ -100,9 +92,7 @@ Return<void> FingerprintInscreen::onRelease() {
Return<void> FingerprintInscreen::onShowFODView() {
this->mFodCircleVisible = true;
this->mVendorDisplayService->setMode(OP_DISPLAY_AOD_MODE, 0);
this->mVendorDisplayService->setMode(OP_DISPLAY_SET_DIM, 0);
this->mVendorDisplayService->setMode(OP_DISPLAY_NOTIFY_PRESS, 0);
this->mVendorDisplayService->setMode(OP_DISPLAY_SET_DIM, 1);
return Void();
}
@ -144,18 +134,7 @@ Return<bool> FingerprintInscreen::handleAcquired(int32_t acquiredInfo, int32_t v
}
Return<bool> FingerprintInscreen::handleError(int32_t error, int32_t vendorCode) {
switch (error) {
case FINGERPRINT_ERROR_CANCELED:
if (vendorCode == 0) {
this->mIsEnrolling = false;
}
return false;
case FINGERPRINT_ERROR_VENDOR:
// Ignore vendorCode 6
return vendorCode == 6;
default:
return false;
}
return error == FINGERPRINT_ERROR_VENDOR && vendorCode == 6;
}
Return<void> FingerprintInscreen::setLongPressEnabled(bool enabled) {

View file

@ -56,7 +56,6 @@ class FingerprintInscreen : public IFingerprintInscreen {
private:
bool mFodCircleVisible;
bool mIsEnrolling;
sp<IOneplusDisplay> mVendorDisplayService;
sp<IVendorFingerprintExtensions> mVendorFpService;