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

Commit 091f2e21 authored by Steve Kondik's avatar Steve Kondik Committed by Michael Bestas
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 b741caae
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2018 The LineageOS Project
     Copyright (C) 2018-2019 The LineageOS Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
@@ -28,4 +29,10 @@
    <!-- Max visible notification icons -->
    <integer name="config_maxVisibleNotificationIcons">4</integer>
    <integer name="config_maxVisibleNotificationIconsWhenDark">5</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>
+16 −6
Original line number Diff line number Diff line
@@ -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 on<biometric>Authenticated
@@ -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 ||
        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;
        return shouldListen;
        }
    }

    private boolean shouldListenForFace() {