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

Commit 65211102 authored by Steve Kondik's avatar Steve Kondik Committed by Wang Han
Browse files

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
parent fa716488
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -22,4 +22,10 @@
         * Right -> 53 (Gravity.TOP | Gravity.RIGHT)
    -->
    <integer name="hardware_ui_align">53</integer>

    <!-- 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>
+15 −5
Original line number Diff line number Diff line
@@ -222,6 +222,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    private LockPatternUtils mLockPatternUtils;
    private final IDreamManager mDreamManager;
    private boolean mIsDreaming;
    private final boolean mFingerprintWakeAndUnlock;

    /**
     * Short delay before restarting fingerprint authentication after a successful try
@@ -1110,6 +1111,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        mSubscriptionManager = SubscriptionManager.from(context);
        mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
        mStrongAuthTracker = new StrongAuthTracker(context);
        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...
@@ -1210,12 +1213,19 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    }

    private boolean shouldListenForFingerprint() {
        if (!mFingerprintWakeAndUnlock) {
            return (mKeyguardIsVisible || mBouncer || shouldListenForFingerprintAssistant() ||
                    (mKeyguardOccluded && mIsDreaming)) && mDeviceInteractive && !mGoingToSleep
                    && !mSwitchingUser && !isFingerprintDisabled(getCurrentUser())
                    && !mKeyguardGoingAway;
        } else {
            return (mKeyguardIsVisible || !mDeviceInteractive ||
                    (mBouncer && !mKeyguardGoingAway) || mGoingToSleep ||
                    shouldListenForFingerprintAssistant() || (mKeyguardOccluded && mIsDreaming))
                    && !mSwitchingUser && !isFingerprintDisabled(getCurrentUser())
                    && !mKeyguardGoingAway;
        }
    }

    private void startListeningForFingerprint() {
        if (mFingerprintRunningState == FINGERPRINT_STATE_CANCELLING) {