OSDN Git Service

Fix message not showing when face auth is enabled
authorLucas Dupin <dupin@google.com>
Thu, 25 Apr 2019 21:34:12 +0000 (14:34 -0700)
committerLucas Dupin <dupin@google.com>
Thu, 25 Apr 2019 21:48:10 +0000 (21:48 +0000)
Old code was checking explicitly for fingerprint, we need something more
generic, that asserts any type of biometrics.

Test: manual
Fixes: 131140362
Change-Id: I5868c54b12c24696bc00a150d7bb3cb3d872015f

packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java

index 1d19fec..83b98b0 100644 (file)
@@ -1670,12 +1670,23 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
         }
     }
 
-    public boolean isUnlockWithFingerprintPossible(int userId) {
+    /**
+     * If biometrics hardware is available, not disabled, and user has enrolled templates.
+     * This does NOT check if the device is encrypted or in lockdown.
+     *
+     * @param userId User that's trying to unlock.
+     * @return {@code true} if possible.
+     */
+    public boolean isUnlockingWithBiometricsPossible(int userId) {
+        return isUnlockWithFacePossible(userId) || isUnlockWithFingerprintPossible(userId);
+    }
+
+    private boolean isUnlockWithFingerprintPossible(int userId) {
         return mFpm != null && mFpm.isHardwareDetected() && !isFingerprintDisabled(userId)
                 && mFpm.getEnrolledFingerprints(userId).size() > 0;
     }
 
-    public boolean isUnlockWithFacePossible(int userId) {
+    private boolean isUnlockWithFacePossible(int userId) {
         return mFaceManager != null && mFaceManager.isHardwareDetected()
                 && !isFaceDisabled(userId)
                 && mFaceManager.hasEnrolledTemplates(userId);
index d363622..1fa6ad6 100644 (file)
@@ -639,8 +639,8 @@ public class KeyguardViewMediator extends SystemUI {
         public int getBouncerPromptReason() {
             int currentUser = ActivityManager.getCurrentUser();
             boolean trust = mTrustManager.isTrustUsuallyManaged(currentUser);
-            boolean fingerprint = mUpdateMonitor.isUnlockWithFingerprintPossible(currentUser);
-            boolean any = trust || fingerprint;
+            boolean biometrics = mUpdateMonitor.isUnlockingWithBiometricsPossible(currentUser);
+            boolean any = trust || biometrics;
             KeyguardUpdateMonitor.StrongAuthTracker strongAuthTracker =
                     mUpdateMonitor.getStrongAuthTracker();
             int strongAuth = strongAuthTracker.getStrongAuthForUser(currentUser);