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
This commit is contained in:
Lucas Dupin
2019-05-16 17:56:43 -07:00
parent 86387b3487
commit 51996bbc03
5 changed files with 48 additions and 6 deletions

View File

@@ -310,7 +310,9 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
@Override
public void showMessage(CharSequence message, ColorStateList colorState) {
mSecurityMessageDisplay.setNextMessageColor(colorState);
if (colorState != null) {
mSecurityMessageDisplay.setNextMessageColor(colorState);
}
mSecurityMessageDisplay.setMessage(message);
}

View File

@@ -438,7 +438,9 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
@Override
public void showMessage(CharSequence message, ColorStateList colorState) {
mSecurityMessageDisplay.setNextMessageColor(colorState);
if (colorState != null) {
mSecurityMessageDisplay.setNextMessageColor(colorState);
}
mSecurityMessageDisplay.setMessage(message);
}

View File

@@ -229,8 +229,10 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
}
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;

View File

@@ -168,6 +168,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
*/
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 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
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 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
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 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
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) {

View File

@@ -78,6 +78,7 @@ public class KeyguardIndicationController implements StateListener,
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 @@ public class KeyguardIndicationController implements StateListener,
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 @@ public class KeyguardIndicationController implements StateListener,
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 @@ public class KeyguardIndicationController implements StateListener,
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);
}
}