OSDN Git Service

keyguard: Allow disabling fingerprint wake-and-unlock
authorSteve Kondik <steve@cyngn.com>
Mon, 2 May 2016 11:01:43 +0000 (04:01 -0700)
committerSteve Kondik <steve@cyngn.com>
Mon, 3 Oct 2016 13:38:05 +0000 (06:38 -0700)
 * When the fingerprint sensor is embedded in the power key,
   wake-and-unlock is total chaos. Add an option to disable it.
 * The default behavior is unchanged.

Change-Id: I50c0a857daba92c17470d8089aca94099c792956

packages/Keyguard/res/values/config.xml
packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java

index 44336d3..f34f6a9 100644 (file)
 
     <!-- config for showing AM/PM on lock screen in 12hour format -->
     <bool name="config_showAmpm">true</bool>
+
+    <!-- Should we listen for fingerprints when the screen is off?  Devices
+         with a rear-mounted sensor want this, but certain devices have
+         the sensor embedded in the power key and listening all the time
+         causes a poor experience. -->
+    <bool name="config_fingerprintWakeAndUnlock">true</bool>
 </resources>
index 6815545..8d09e99 100755 (executable)
@@ -1110,9 +1110,16 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
     }
 
     private boolean shouldListenForFingerprint() {
-        return (mKeyguardIsVisible || !mDeviceInteractive || mBouncer || mGoingToSleep)
-                && !mSwitchingUser && !mFingerprintAlreadyAuthenticated
-                && !isFingerprintDisabled(getCurrentUser());
+        if (!mSwitchingUser && !mFingerprintAlreadyAuthenticated
+                && !isFingerprintDisabled(getCurrentUser())) {
+            if (mContext.getResources().getBoolean(
+                    com.android.keyguard.R.bool.config_fingerprintWakeAndUnlock)) {
+                return mKeyguardIsVisible || !mDeviceInteractive || mBouncer || mGoingToSleep;
+            } else {
+                return mDeviceInteractive && (mKeyguardIsVisible || mBouncer);
+            }
+        }
+        return false;
     }
 
     private void startListeningForFingerprint() {