From 091f2e21eb3a8387f90e30af4047a78958985e89 Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Mon, 2 May 2016 04:01:43 -0700 Subject: Keyguard: Allow disabling fingerprint wake-and-unlock * 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/SystemUI/res/values/lineage_config.xml | 9 ++++++++- .../android/keyguard/KeyguardUpdateMonitor.java | 22 ++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/res/values/lineage_config.xml b/packages/SystemUI/res/values/lineage_config.xml index 242950c63db..2ee6d40097b 100644 --- a/packages/SystemUI/res/values/lineage_config.xml +++ b/packages/SystemUI/res/values/lineage_config.xml @@ -1,5 +1,6 @@ + 4 5 + + + true diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 6a4dbc8d722..e5f4a11ba4c 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -241,6 +241,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { // If the user long pressed the lock icon, disabling face auth for the current session. private boolean mLockIconPressed; + private final boolean mFingerprintWakeAndUnlock; + /** * Short delay before restarting biometric authentication after a successful try * This should be slightly longer than the time between onAuthenticated @@ -1435,6 +1437,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { mSubscriptionManager = SubscriptionManager.from(context); mDeviceProvisioned = isDeviceProvisionedInSettingsDb(); mStrongAuthTracker = new StrongAuthTracker(context, this::notifyStrongAuthStateChanged); + mFingerprintWakeAndUnlock = mContext.getResources().getBoolean( + com.android.keyguard.R.bool.config_fingerprintWakeAndUnlock); // Since device can't be un-provisioned, we only need to register a content observer // to update mDeviceProvisioned when we are... @@ -1613,12 +1617,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private boolean shouldListenForFingerprint() { // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware. - final boolean shouldListen = (mKeyguardIsVisible || !mDeviceInteractive || - (mBouncer && !mKeyguardGoingAway) || mGoingToSleep || - shouldListenForFingerprintAssistant() || (mKeyguardOccluded && mIsDreaming)) - && !mSwitchingUser && !isFingerprintDisabled(getCurrentUser()) - && (!mKeyguardGoingAway || !mDeviceInteractive) && mIsPrimaryUser; - return shouldListen; + if (!mFingerprintWakeAndUnlock) { + return (mKeyguardIsVisible || mBouncer || shouldListenForFingerprintAssistant() || + (mKeyguardOccluded && mIsDreaming)) && mDeviceInteractive && !mGoingToSleep + && !mSwitchingUser && !isFingerprintDisabled(getCurrentUser()) + && (!mKeyguardGoingAway || !mDeviceInteractive) && mIsPrimaryUser; + } else { + return (mKeyguardIsVisible || !mDeviceInteractive || + (mBouncer && !mKeyguardGoingAway) || mGoingToSleep || + shouldListenForFingerprintAssistant() || (mKeyguardOccluded && mIsDreaming)) + && !mSwitchingUser && !isFingerprintDisabled(getCurrentUser()) + && (!mKeyguardGoingAway || !mDeviceInteractive) && mIsPrimaryUser; + } } private boolean shouldListenForFace() { -- cgit v1.2.3