OSDN Git Service

Stop face auth requests when users are typing
authorLucas Dupin <dupin@google.com>
Wed, 7 Aug 2019 19:53:02 +0000 (12:53 -0700)
committerLucas Dupin <dupin@google.com>
Wed, 7 Aug 2019 19:57:31 +0000 (12:57 -0700)
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

packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java
packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java
packages/SystemUI/src/com/android/keyguard/KeyguardSecurityCallback.java
packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java

index a4b6958..517abac 100644 (file)
@@ -253,6 +253,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
     protected void onUserInput() {
         if (mCallback != null) {
             mCallback.userActivity();
+            mCallback.onUserInput();
         }
         mSecurityMessageDisplay.setMessage("");
     }
index 55ddfc3..56b38f7 100644 (file)
@@ -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();
             }
         }
 
index cbfbffb..49dcfff 100644 (file)
@@ -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();
 }
index 8059dcf..169c97b 100644 (file)
@@ -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() {}
     };
 
index 8f7070e..72ad993 100644 (file)
@@ -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