Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72808e64 authored by Chandru S's avatar Chandru S
Browse files

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
parent f9be5327
Loading
Loading
Loading
Loading
+15 −0
Original line number Original line Diff line number Diff line
@@ -1460,6 +1460,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                        ErrorAuthenticationStatus error = (ErrorAuthenticationStatus) status;
                        ErrorAuthenticationStatus error = (ErrorAuthenticationStatus) status;
                        handleFaceError(error.getMsgId(), error.getMsg());
                        handleFaceError(error.getMsgId(), error.getMsg());
                    } else if (status instanceof FailedAuthenticationStatus) {
                    } 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();
                        handleFaceAuthFailed();
                    } else if (status instanceof HelpAuthenticationStatus) {
                    } else if (status instanceof HelpAuthenticationStatus) {
                        HelpAuthenticationStatus helpMsg = (HelpAuthenticationStatus) status;
                        HelpAuthenticationStatus helpMsg = (HelpAuthenticationStatus) status;
@@ -1968,6 +1976,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab


                @Override
                @Override
                public void onAuthenticationFailed() {
                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();
                    handleFaceAuthFailed();
                }
                }