fingerprint: set dimlayer_hbm on finger up/down instead of auth/cancel
When dimlayer_hbm is enabled, HWC ends up disabling all color transformations, including Night Light. Since we enable/disable dimlayer_hbm on authenticate/cancel, this means that whenever the UDFPS circle is present, Night Light ends up temporarily turning off. This is especially not helpful on the lock screen, where the UDFPS circle is active all the time. Instead of turning on dimlayer_hbm during the entire time that the UDFPS circle is showing, let's turn on dimlayer_hbm only when the user is pressing down on the circle. In doing so, the color transformations will be disabled for only when the user is touching the circle. We will still disable dimlayer_hbm on cancel anyway, just in case that wasn't already set to off by the time cancel() is called. However, when enrolling a new fingerprint, the user is going to be tapping on the UDFPS circle many, many times, and the user may prefer to just keep dimlayer on for the entire duration. Add `isEnrolling` to track that, and don't change dimlayer state while that is set to true. Change-Id: I9ed1a6b5839e39b8f70ff4af4ebe8d1bc66ffb98 Signed-off-by: AnierinB <anierin@evolution-x.org>
This commit is contained in:
@@ -38,6 +38,7 @@ Return<uint64_t> BiometricsFingerprint::setNotify(
|
||||
}
|
||||
|
||||
Return<uint64_t> BiometricsFingerprint::preEnroll() {
|
||||
this->isEnrolling = true;
|
||||
setDimlayerHbm(1);
|
||||
return mOplusBiometricsFingerprint->preEnroll();
|
||||
}
|
||||
@@ -48,6 +49,7 @@ Return<RequestStatus> BiometricsFingerprint::enroll(const hidl_array<uint8_t, 69
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::postEnroll() {
|
||||
this->isEnrolling = false;
|
||||
setDimlayerHbm(0);
|
||||
return mOplusBiometricsFingerprint->postEnroll();
|
||||
}
|
||||
@@ -57,7 +59,9 @@ Return<uint64_t> BiometricsFingerprint::getAuthenticatorId() {
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::cancel() {
|
||||
setDimlayerHbm(0);
|
||||
if (!this->isEnrolling) {
|
||||
setDimlayerHbm(0);
|
||||
}
|
||||
return mOplusBiometricsFingerprint->cancel();
|
||||
}
|
||||
|
||||
@@ -75,7 +79,8 @@ Return<RequestStatus> BiometricsFingerprint::setActiveGroup(uint32_t gid,
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::authenticate(uint64_t operationId, uint32_t gid) {
|
||||
setDimlayerHbm(1);
|
||||
// In case postEnroll never got called for whatever reason, set isEnrolling to false.
|
||||
this->isEnrolling = false;
|
||||
return mOplusBiometricsFingerprint->authenticate(operationId, gid);
|
||||
}
|
||||
|
||||
@@ -84,12 +89,18 @@ Return<bool> BiometricsFingerprint::isUdfps(uint32_t sensorID) {
|
||||
}
|
||||
|
||||
Return<void> BiometricsFingerprint::onFingerDown(uint32_t x, uint32_t y, float minor, float major) {
|
||||
if (!this->isEnrolling) {
|
||||
setDimlayerHbm(1);
|
||||
}
|
||||
setFpPress(1);
|
||||
return mOplusBiometricsFingerprint->onFingerDown(x, y, minor, major);
|
||||
}
|
||||
|
||||
Return<void> BiometricsFingerprint::onFingerUp() {
|
||||
setFpPress(0);
|
||||
if (!this->isEnrolling) {
|
||||
setDimlayerHbm(0);
|
||||
}
|
||||
return mOplusBiometricsFingerprint->onFingerUp();
|
||||
}
|
||||
|
||||
@@ -116,8 +127,10 @@ Return<void> BiometricsFingerprint::onAuthenticated(uint64_t deviceId, uint32_t
|
||||
|
||||
Return<void> BiometricsFingerprint::onError(uint64_t deviceId, FingerprintError error,
|
||||
int32_t vendorCode) {
|
||||
setDimlayerHbm(0);
|
||||
setFpPress(0);
|
||||
if (!this->isEnrolling) {
|
||||
setDimlayerHbm(0);
|
||||
}
|
||||
return mClientCallback->onError(deviceId, error, vendorCode);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@ class BiometricsFingerprint : public IBiometricsFingerprint,
|
||||
sp<V2_1::IBiometricsFingerprintClientCallback> mClientCallback;
|
||||
|
||||
int mOplusDisplayFd;
|
||||
bool isEnrolling;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
Reference in New Issue
Block a user