Don't show hint while authenticating, show hint while pending confirmation
Also, restore "enabled" state of confirm button, otherwise it becomes
available when changing configurations.
Also, "confirm" button should become visible+disabled when tapping try again
Fixes: 135618797
Test: E2E fingerprint and face, with various tests such as rotation during
various states
Change-Id: I1073a4479077355f1c275faed933ac8510927251
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index fdf0bc9..712ce6e 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -303,6 +303,8 @@
<string name="biometric_dialog_face_icon_description_authenticated">Face authenticated</string>
<!-- Content description for the face icon when the user has been authenticated and the confirm button has been pressed [CHAR LIMIT=NONE] -->
<string name="biometric_dialog_face_icon_description_confirmed">Confirmed</string>
+ <!-- Message shown when a biometric is authenticated, waiting for the user to confirm authentication [CHAR LIMIT=40]-->
+ <string name="biometric_dialog_tap_confirm">Tap Confirm to complete</string>
<!-- Message shown when the system-provided fingerprint dialog is shown, asking for authentication -->
<string name="fingerprint_dialog_touch_sensor">Touch the fingerprint sensor</string>
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogView.java b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogView.java
index 443c4e7..0f0f095 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 @@
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 @@
handleResetMessage();
updateState(STATE_AUTHENTICATING);
showTryAgainButton(false /* show */);
+
+ mPositiveButton.setVisibility(View.VISIBLE);
+ mPositiveButton.setEnabled(false);
+
mCallback.onTryAgainPressed();
});
@@ -243,6 +248,7 @@
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 @@
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 @@
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 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 @@
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 91124cb..729242e 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 @@
@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 @@
@Override
protected int getHintStringResourceId() {
- return R.string.face_dialog_looking_for_face;
+ return 0;
}
@Override
@@ -408,7 +402,6 @@
mHandler.removeCallbacks(mErrorToIdleAnimationRunnable);
if (mDialogAnimatedIn) {
mIconController.startPulsing();
- mErrorText.setVisibility(View.VISIBLE);
} else {
mIconController.showIcon(R.drawable.face_dialog_pulse_dark_to_light);
}