Face auth messaging cleanup
Do not show timeout message, and ask user to swipe up to retry when
auth fails.
Fixes: 132465944
Test: biometric error on bouncer and LS
Test: wait for face timeout
Change-Id: Iec757f25d5f09b05ac02811e2eeef6ac98f63f16
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java
index 2ff7266..a4b6958 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java
@@ -310,7 +310,9 @@
@Override
public void showMessage(CharSequence message, ColorStateList colorState) {
- mSecurityMessageDisplay.setNextMessageColor(colorState);
+ if (colorState != null) {
+ mSecurityMessageDisplay.setNextMessageColor(colorState);
+ }
mSecurityMessageDisplay.setMessage(message);
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java
index 0e91e41..f3baf8d 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java
@@ -438,7 +438,9 @@
@Override
public void showMessage(CharSequence message, ColorStateList colorState) {
- mSecurityMessageDisplay.setNextMessageColor(colorState);
+ if (colorState != null) {
+ mSecurityMessageDisplay.setNextMessageColor(colorState);
+ }
mSecurityMessageDisplay.setMessage(message);
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
index 0914fb8..7259232 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -229,8 +229,10 @@
}
if (action == MotionEvent.ACTION_UP) {
if (-getTranslationY() > TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
- MIN_DRAG_SIZE, getResources().getDisplayMetrics())) {
+ MIN_DRAG_SIZE, getResources().getDisplayMetrics())
+ && !mUpdateMonitor.isFaceDetectionRunning()) {
mUpdateMonitor.requestFaceAuth();
+ showMessage(null, null);
}
}
return true;
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index ea8565e..21b9ad9 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -168,6 +168,9 @@
*/
private static final int BIOMETRIC_STATE_CANCELLING_RESTARTING = 3;
+ private static final int BIOMETRIC_HELP_FINGERPRINT_NOT_RECOGNIZED = -1;
+ public static final int BIOMETRIC_HELP_FACE_NOT_RECOGNIZED = -2;
+
private static final int DEFAULT_CHARGING_VOLTAGE_MICRO_VOLT = 5000000;
private static final ComponentName FALLBACK_HOME_COMPONENT = new ComponentName(
@@ -570,7 +573,8 @@
cb.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT);
}
}
- handleFingerprintHelp(-1, mContext.getString(R.string.kg_fingerprint_not_recognized));
+ handleFingerprintHelp(BIOMETRIC_HELP_FINGERPRINT_NOT_RECOGNIZED,
+ mContext.getString(R.string.kg_fingerprint_not_recognized));
}
private void handleFingerprintAcquired(int acquireInfo) {
@@ -722,7 +726,8 @@
cb.onBiometricAuthFailed(BiometricSourceType.FACE);
}
}
- handleFaceHelp(-1, mContext.getString(R.string.kg_face_not_recognized));
+ handleFaceHelp(BIOMETRIC_HELP_FACE_NOT_RECOGNIZED,
+ mContext.getString(R.string.kg_face_not_recognized));
}
private void handleFaceAcquired(int acquireInfo) {
@@ -803,6 +808,11 @@
getCurrentUser());
}
+ // The face timeout message is not very actionable, let's ask the user to
+ // manually retry.
+ if (msgId == FaceManager.FACE_ERROR_TIMEOUT) {
+ errString = mContext.getString(R.string.keyguard_unlock);
+ }
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index fd76a79..25bde3b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -78,6 +78,7 @@
private static final int MSG_HIDE_TRANSIENT = 1;
private static final int MSG_CLEAR_BIOMETRIC_MSG = 2;
+ private static final int MSG_SWIPE_UP_TO_UNLOCK = 3;
private static final long TRANSIENT_BIOMETRIC_ERROR_TIMEOUT = 1300;
private final Context mContext;
@@ -318,6 +319,7 @@
mTransientIndication = transientIndication;
mTransientTextColorState = textColorState;
mHandler.removeMessages(MSG_HIDE_TRANSIENT);
+ mHandler.removeMessages(MSG_SWIPE_UP_TO_UNLOCK);
if (mDozing && !TextUtils.isEmpty(mTransientIndication)) {
// Make sure this doesn't get stuck and burns in. Acquire wakelock until its cleared.
mWakeLock.setAcquired(true);
@@ -536,10 +538,26 @@
hideTransientIndication();
} else if (msg.what == MSG_CLEAR_BIOMETRIC_MSG) {
mLockIcon.setTransientBiometricsError(false);
+ } else if (msg.what == MSG_SWIPE_UP_TO_UNLOCK) {
+ showSwipeUpToUnlock();
}
}
};
+ private void showSwipeUpToUnlock() {
+ if (mDozing) {
+ return;
+ }
+
+ String message = mContext.getString(R.string.keyguard_unlock);
+ if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
+ mStatusBarKeyguardViewManager.showBouncerMessage(message, mInitialTextColorState);
+ } else if (mKeyguardUpdateMonitor.isScreenOn()) {
+ showTransientIndication(message);
+ hideTransientIndicationDelayed(BaseKeyguardCallback.HIDE_DELAY_MS);
+ }
+ }
+
public void setDozing(boolean dozing) {
if (mDozing == dozing) {
return;
@@ -620,12 +638,20 @@
return;
}
animatePadlockError();
+ boolean showSwipeToUnlock =
+ msgId == KeyguardUpdateMonitor.BIOMETRIC_HELP_FACE_NOT_RECOGNIZED;
if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
mStatusBarKeyguardViewManager.showBouncerMessage(helpString,
mInitialTextColorState);
} else if (updateMonitor.isScreenOn()) {
showTransientIndication(helpString);
- hideTransientIndicationDelayed(TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
+ if (!showSwipeToUnlock) {
+ hideTransientIndicationDelayed(TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
+ }
+ }
+ if (showSwipeToUnlock) {
+ mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SWIPE_UP_TO_UNLOCK),
+ TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
}
}