1
0
mirror of https://github.com/yurisieucuti/treble_evolution.git synced 2024-11-24 12:06:19 +00:00
treble_evolution/patches/trebledroid/platform_frameworks_base/0045-fix-fod-Extra-Dim-overlap-fod-overlay.patch
2024-03-10 06:48:11 +00:00

87 lines
4.4 KiB
Diff

From fcbf4a35bdaae699adc1c271ad557f853891e9e4 Mon Sep 17 00:00:00 2001
From: MrHereAndThere <38396158+boydaihungst@users.noreply.github.com>
Date: Fri, 17 Nov 2023 09:22:29 +0700
Subject: [PATCH 45/56] fix(fod): Extra Dim overlap fod overlay
Extra Dim will set display panel brightness to lowest value possible, which will also effect FOD overlay.
---
.../systemui/biometrics/UdfpsController.java | 20 +++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
index 19b67b5f3def..ef5e4f617138 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
@@ -42,6 +42,7 @@ import android.hardware.fingerprint.FingerprintSensorProperties;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.hardware.fingerprint.IUdfpsOverlayController;
import android.hardware.fingerprint.IUdfpsOverlayControllerCallback;
+import android.hardware.display.ColorDisplayManager;
import android.hardware.input.InputManager;
import android.os.Build;
import android.os.Handler;
@@ -184,6 +185,8 @@ public class UdfpsController implements DozeReceiver, Dumpable {
@NonNull private final UdfpsUtils mUdfpsUtils;
@NonNull private final InputManager mInputManager;
@NonNull private final UdfpsKeyguardAccessibilityDelegate mUdfpsKeyguardAccessibilityDelegate;
+ @NonNull private final ColorDisplayManager mColorDisplayManager;
+ private boolean mIgnoreExtraDim;
private final boolean mIgnoreRefreshRate;
// Currently the UdfpsController supports a single UDFPS sensor. If devices have multiple
@@ -898,7 +901,8 @@ public class UdfpsController implements DozeReceiver, Dumpable {
@NonNull UdfpsUtils udfpsUtils,
@NonNull KeyguardFaceAuthInteractor keyguardFaceAuthInteractor,
@NonNull UdfpsKeyguardAccessibilityDelegate udfpsKeyguardAccessibilityDelegate,
- @NonNull Provider<UdfpsKeyguardViewModels> udfpsKeyguardViewModelsProvider) {
+ @NonNull Provider<UdfpsKeyguardViewModels> udfpsKeyguardViewModelsProvider,
+ @NonNull ColorDisplayManager colorDisplayManager) {
mContext = context;
mExecution = execution;
mVibrator = vibrator;
@@ -945,6 +949,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
mUdfpsUtils = udfpsUtils;
mInputManager = inputManager;
mUdfpsKeyguardAccessibilityDelegate = udfpsKeyguardAccessibilityDelegate;
+ mColorDisplayManager = colorDisplayManager;
mTouchProcessor = mFeatureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION)
? singlePointerTouchProcessor : null;
@@ -1025,7 +1030,10 @@ public class UdfpsController implements DozeReceiver, Dumpable {
private void showUdfpsOverlay(@NonNull UdfpsControllerOverlay overlay) {
mExecution.assertIsMainThread();
-
+ mIgnoreExtraDim = mColorDisplayManager.isReduceBrightColorsActivated();
+ if (mIgnoreExtraDim) {
+ Log.d(TAG, "Current extra dim state (showUdfpsOverlay): " + mIgnoreExtraDim);
+ }
mOverlay = overlay;
final int requestReason = overlay.getRequestReason();
if (requestReason == REASON_AUTH_KEYGUARD
@@ -1244,6 +1252,10 @@ public class UdfpsController implements DozeReceiver, Dumpable {
return;
}
if (isOptical()) {
+ if (mIgnoreExtraDim) {
+ mColorDisplayManager.setReduceBrightColorsActivated(false);
+ Log.d(TAG, "Extra dim disabled");
+ }
mLatencyTracker.onActionStart(LatencyTracker.ACTION_UDFPS_ILLUMINATE);
}
// Refresh screen timeout and boost process priority if possible.
@@ -1330,6 +1342,10 @@ public class UdfpsController implements DozeReceiver, Dumpable {
mActivePointerId = -1;
mAcquiredReceived = false;
if (mOnFingerDown) {
+ if (mIgnoreExtraDim && isOptical()) {
+ mColorDisplayManager.setReduceBrightColorsActivated(true);
+ Log.d(TAG, "Extra dim restored");
+ }
if (mAlternateTouchProvider != null) {
mBiometricExecutor.execute(() -> {
mAlternateTouchProvider.onPointerUp(requestId);
--
2.25.1