diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index c9bbb09275108..b60ed19dac9f4 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -303,6 +303,8 @@ Face authenticated Confirmed + + Tap Confirm to complete Touch the fingerprint sensor diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogView.java b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogView.java index 443c4e7be5d1e..0f0f09579f873 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogView.java @@ -59,6 +59,7 @@ public abstract class BiometricDialogView extends LinearLayout { private static final String KEY_TRY_AGAIN_VISIBILITY = "key_try_again_visibility"; private static final String KEY_CONFIRM_VISIBILITY = "key_confirm_visibility"; + private static final String KEY_CONFIRM_ENABLED = "key_confirm_enabled"; private static final String KEY_STATE = "key_state"; private static final String KEY_ERROR_TEXT_VISIBILITY = "key_error_text_visibility"; private static final String KEY_ERROR_TEXT_STRING = "key_error_text_string"; @@ -232,6 +233,10 @@ public abstract class BiometricDialogView extends LinearLayout { handleResetMessage(); updateState(STATE_AUTHENTICATING); showTryAgainButton(false /* show */); + + mPositiveButton.setVisibility(View.VISIBLE); + mPositiveButton.setEnabled(false); + mCallback.onTryAgainPressed(); }); @@ -243,6 +248,7 @@ public abstract class BiometricDialogView extends LinearLayout { public void onSaveState(Bundle bundle) { bundle.putInt(KEY_TRY_AGAIN_VISIBILITY, mTryAgainButton.getVisibility()); bundle.putInt(KEY_CONFIRM_VISIBILITY, mPositiveButton.getVisibility()); + bundle.putBoolean(KEY_CONFIRM_ENABLED, mPositiveButton.isEnabled()); bundle.putInt(KEY_STATE, mState); bundle.putInt(KEY_ERROR_TEXT_VISIBILITY, mErrorText.getVisibility()); bundle.putCharSequence(KEY_ERROR_TEXT_STRING, mErrorText.getText()); @@ -275,9 +281,15 @@ public abstract class BiometricDialogView extends LinearLayout { if (mRestoredState == null) { updateState(STATE_AUTHENTICATING); - mErrorText.setText(getHintStringResourceId()); - mErrorText.setContentDescription(mContext.getString(getHintStringResourceId())); - mErrorText.setVisibility(View.VISIBLE); + final int hint = getHintStringResourceId(); + if (hint != 0) { + mErrorText.setText(hint); + mErrorText.setContentDescription(mContext.getString(hint)); + mErrorText.setVisibility(View.VISIBLE); + } else { + mErrorText.setVisibility(View.INVISIBLE); + } + announceAccessibilityEvent(); } else { updateState(mState); } @@ -425,6 +437,7 @@ public abstract class BiometricDialogView extends LinearLayout { mErrorText.setText(message); mErrorText.setTextColor(mErrorColor); mErrorText.setContentDescription(message); + mErrorText.setVisibility(View.VISIBLE); mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_RESET_MESSAGE), BiometricPrompt.HIDE_DIALOG_DELAY); } @@ -458,7 +471,9 @@ public abstract class BiometricDialogView extends LinearLayout { public void updateState(int newState) { if (newState == STATE_PENDING_CONFIRMATION) { mHandler.removeMessages(MSG_RESET_MESSAGE); - mErrorText.setVisibility(View.INVISIBLE); + mErrorText.setTextColor(mTextColor); + mErrorText.setText(R.string.biometric_dialog_tap_confirm); + mErrorText.setVisibility(View.VISIBLE); announceAccessibilityEvent(); mPositiveButton.setVisibility(View.VISIBLE); mPositiveButton.setEnabled(true); @@ -489,6 +504,8 @@ public abstract class BiometricDialogView extends LinearLayout { mTryAgainButton.setVisibility(tryAgainVisibility); final int confirmVisibility = bundle.getInt(KEY_CONFIRM_VISIBILITY); mPositiveButton.setVisibility(confirmVisibility); + final boolean confirmEnabled = bundle.getBoolean(KEY_CONFIRM_ENABLED); + mPositiveButton.setEnabled(confirmEnabled); mState = bundle.getInt(KEY_STATE); mErrorText.setText(bundle.getCharSequence(KEY_ERROR_TEXT_STRING)); mErrorText.setContentDescription(bundle.getCharSequence(KEY_ERROR_TEXT_STRING)); diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/FaceDialogView.java b/packages/SystemUI/src/com/android/systemui/biometrics/FaceDialogView.java index 91124cb443bef..729242e3144f2 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/FaceDialogView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/FaceDialogView.java @@ -289,15 +289,9 @@ public class FaceDialogView extends BiometricDialogView { @Override protected void handleResetMessage() { - mErrorText.setText(getHintStringResourceId()); - mErrorText.setContentDescription(mContext.getString(getHintStringResourceId())); mErrorText.setTextColor(mTextColor); - if (getState() == STATE_AUTHENTICATING) { - mErrorText.setVisibility(View.VISIBLE); - } else { - mErrorText.setVisibility(View.INVISIBLE); - announceAccessibilityEvent(); - } + mErrorText.setVisibility(View.INVISIBLE); + announceAccessibilityEvent(); } @Override @@ -383,7 +377,7 @@ public class FaceDialogView extends BiometricDialogView { @Override protected int getHintStringResourceId() { - return R.string.face_dialog_looking_for_face; + return 0; } @Override @@ -408,7 +402,6 @@ public class FaceDialogView extends BiometricDialogView { mHandler.removeCallbacks(mErrorToIdleAnimationRunnable); if (mDialogAnimatedIn) { mIconController.startPulsing(); - mErrorText.setVisibility(View.VISIBLE); } else { mIconController.showIcon(R.drawable.face_dialog_pulse_dark_to_light); }