From 72808e643954ca65b91ba3e5699ca4a22bba4def Mon Sep 17 00:00:00 2001 From: Chandru S Date: Thu, 11 May 2023 20:15:10 -0700 Subject: [PATCH] Add a hack that ensures face auth failed message is not shown after face lockout Bug: 270090188 Test: atest KeyguardUpdateMonitorTest Test: manually, 1. enroll a friend's face for auth 2. Lock the phone 3. Try face auth 3 times 4. on the first lockout, we should see too many attempts 5. after that, we should see face unlock unavailable. Change-Id: I1354f5f6159fb371313ecac3905c545e2af6a62d --- .../android/keyguard/KeyguardUpdateMonitor.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 0d4b543a63925..833292e18819f 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -1460,6 +1460,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab ErrorAuthenticationStatus error = (ErrorAuthenticationStatus) status; handleFaceError(error.getMsgId(), error.getMsg()); } else if (status instanceof FailedAuthenticationStatus) { + if (isFaceLockedOut()) { + // TODO b/270090188: remove this hack when biometrics fixes this issue. + // FailedAuthenticationStatus is emitted after ErrorAuthenticationStatus + // for lockout error is received + mLogger.d("onAuthenticationFailed called after" + + " face has been locked out"); + return; + } handleFaceAuthFailed(); } else if (status instanceof HelpAuthenticationStatus) { HelpAuthenticationStatus helpMsg = (HelpAuthenticationStatus) status; @@ -1968,6 +1976,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab @Override public void onAuthenticationFailed() { + if (isFaceLockedOut()) { + // TODO b/270090188: remove this hack when biometrics fixes this issue. + // onAuthenticationFailed is called after onAuthenticationError + // for lockout error is received + mLogger.d("onAuthenticationFailed called after face has been locked out"); + return; + } handleFaceAuthFailed(); }