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

Commit ccf6721e authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Stop face auth requests when users are typing

We don't want the bouncer to be dismissed right under the user's finger
when typing.
Let's abort face auth after we start typing.

Test: solve challenge when face auth is running
Test: repeat for pin/pattern/password
Fixes: 136525169
Change-Id: I8f1ccbca4be9c84f5cb108618b84aefe03b74cc4
parent a0c8c12d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -253,6 +253,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
    protected void onUserInput() {
        if (mCallback != null) {
            mCallback.userActivity();
            mCallback.onUserInput();
        }
        mSecurityMessageDisplay.setMessage("");
    }
+2 −0
Original line number Diff line number Diff line
@@ -274,6 +274,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
        @Override
        public void onPatternCellAdded(List<LockPatternView.Cell> pattern) {
            mCallback.userActivity();
            mCallback.onUserInput();
        }

        @Override
@@ -336,6 +337,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
                    });
            if (pattern.size() > MIN_PATTERN_BEFORE_POKE_WAKELOCK) {
                mCallback.userActivity();
                mCallback.onUserInput();
            }
        }

+5 −0
Original line number Diff line number Diff line
@@ -55,4 +55,9 @@ public interface KeyguardSecurityCallback {
    default void onCancelClicked() {
        // No-op
    }

    /**
     * Invoked whenever users are typing their password or drawing a pattern.
     */
    void onUserInput();
}
+7 −0
Original line number Diff line number Diff line
@@ -596,6 +596,11 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
            }
        }

        @Override
        public void onUserInput() {
            mUpdateMonitor.cancelFaceAuth();
        }

        public void dismiss(boolean authenticated, int targetId) {
            mSecurityCallback.dismiss(authenticated, targetId);
        }
@@ -640,6 +645,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
        @Override
        public void dismiss(boolean securityVerified, int targetUserId) { }
        @Override
        public void onUserInput() { }
        @Override
        public void reset() {}
    };

+7 −0
Original line number Diff line number Diff line
@@ -1641,6 +1641,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        updateFaceListeningState();
    }

    /**
     * In case face auth is running, cancel it.
     */
    public void cancelFaceAuth() {
        stopListeningForFace();
    }

    private void updateFaceListeningState() {
        // If this message exists, we should not authenticate again until this message is
        // consumed by the handler