From 8a239179adb48413b029c67c11d5c8e9e6f98ec1 Mon Sep 17 00:00:00 2001 From: Curtis Belmonte Date: Tue, 19 Jan 2021 12:02:22 -0800 Subject: [PATCH] Fix fingerprint dialog color contrast for dark theme The code to set the color of the help text shown on the fingerprint dialog does not currently check the context theme. This means that the wrong color is used when the system is using a dark theme. This commit fixes the issue by ensuring the appropriate themed color is used. It also increases the contrast of the dark theme color so that the text is more visible against the dialog background. Test: Set system theme to dark mode and trigger the fingerprint dialog. Bug: 174831630 Change-Id: I41dfb536e72063ae8ea84d51fa0e50613f920090 --- packages/SystemUI/res/values-night/colors.xml | 2 +- .../systemui/biometrics/AuthBiometricFaceView.java | 13 ++++++------- .../biometrics/AuthBiometricFingerprintView.java | 2 +- .../systemui/biometrics/AuthBiometricView.java | 8 ++++---- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/SystemUI/res/values-night/colors.xml b/packages/SystemUI/res/values-night/colors.xml index d0aef6fe2e65a..f93de804bfdc5 100644 --- a/packages/SystemUI/res/values-night/colors.xml +++ b/packages/SystemUI/res/values-night/colors.xml @@ -73,7 +73,7 @@ #85ffffff - #ff888888 + #ffcccccc #ff80cbc4 #fff28b82 diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricFaceView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricFaceView.java index e4f6d6cc68874..9b09cfd0dba69 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricFaceView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricFaceView.java @@ -160,12 +160,12 @@ public class AuthBiometricFaceView extends AuthBiometricView { @Override protected void handleResetAfterError() { - resetErrorView(mContext, mIndicatorView); + resetErrorView(); } @Override protected void handleResetAfterHelp() { - resetErrorView(mContext, mIndicatorView); + resetErrorView(); } @Override @@ -185,7 +185,7 @@ public class AuthBiometricFaceView extends AuthBiometricView { if (newState == STATE_AUTHENTICATING_ANIMATING_IN || (newState == STATE_AUTHENTICATING && getSize() == AuthDialog.SIZE_MEDIUM)) { - resetErrorView(mContext, mIndicatorView); + resetErrorView(); } // Do this last since the state variable gets updated. @@ -204,9 +204,8 @@ public class AuthBiometricFaceView extends AuthBiometricView { super.onAuthenticationFailed(failureReason); } - static void resetErrorView(Context context, TextView textView) { - textView.setTextColor(context.getResources().getColor( - R.color.biometric_dialog_gray, context.getTheme())); - textView.setVisibility(View.INVISIBLE); + private void resetErrorView() { + mIndicatorView.setTextColor(mTextColorHint); + mIndicatorView.setVisibility(View.INVISIBLE); } } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricFingerprintView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricFingerprintView.java index 176e9e6b1c9bc..45ee4ad9ae501 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricFingerprintView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricFingerprintView.java @@ -78,7 +78,7 @@ public class AuthBiometricFingerprintView extends AuthBiometricView { private void showTouchSensorString() { mIndicatorView.setText(R.string.fingerprint_dialog_touch_sensor); - mIndicatorView.setTextColor(R.color.biometric_dialog_gray); + mIndicatorView.setTextColor(mTextColorHint); } private void updateIcon(int lastState, int newState) { diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java index c748ab21b8223..18206efefe9a4 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java @@ -83,7 +83,7 @@ public abstract class AuthBiometricView extends LinearLayout { * Authenticated, dialog animating away soon. */ protected static final int STATE_AUTHENTICATED = 6; - + @Retention(RetentionPolicy.SOURCE) @IntDef({STATE_IDLE, STATE_AUTHENTICATING_ANIMATING_IN, STATE_AUTHENTICATING, STATE_HELP, STATE_ERROR, STATE_PENDING_CONFIRMATION, STATE_AUTHENTICATED}) @@ -168,8 +168,8 @@ public abstract class AuthBiometricView extends LinearLayout { private final Injector mInjector; private final Handler mHandler; private final AccessibilityManager mAccessibilityManager; - private final int mTextColorError; - private final int mTextColorHint; + protected final int mTextColorError; + protected final int mTextColorHint; private AuthPanelController mPanelController; private PromptInfo mPromptInfo; @@ -183,7 +183,7 @@ public abstract class AuthBiometricView extends LinearLayout { private TextView mDescriptionView; private View mIconHolderView; protected ImageView mIconView; - @VisibleForTesting protected TextView mIndicatorView; + protected TextView mIndicatorView; // Negative button position, exclusively for the app-specified behavior @VisibleForTesting Button mNegativeButton;