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

Commit 1108fc36 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 5d5e5e2c
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.
@@ -21,4 +22,10 @@
    <!-- Max visible notification icons -->
    <integer name="config_maxVisibleNotificationIcons">4</integer>
    <integer name="config_maxVisibleNotificationIconsOnLock">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>
+13 −2
Original line number Diff line number Diff line
@@ -285,6 +285,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    private int mActiveMobileDataSubscription = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
    private final Executor mBackgroundExecutor;

    private final boolean mFingerprintWakeAndUnlock;

    /**
     * Short delay before restarting fingerprint authentication after a successful try. This should
     * be slightly longer than the time between onFingerprintAuthenticated and
@@ -1568,6 +1570,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        mSubscriptionManager = SubscriptionManager.from(context);
        mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
        mStrongAuthTracker = new StrongAuthTracker(context, this::notifyStrongAuthStateChanged);
        mFingerprintWakeAndUnlock = mContext.getResources().getBoolean(
                com.android.systemui.R.bool.config_fingerprintWakeAndUnlock);
        mBackgroundExecutor = backgroundExecutor;
        mBroadcastDispatcher = broadcastDispatcher;
        mRingerModeTracker = ringerModeTracker;
@@ -1940,13 +1944,20 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab

        // 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
                && allowedOnBouncer;
        } else {
           return (mKeyguardIsVisible || !mDeviceInteractive ||
                (mBouncer && !mKeyguardGoingAway) || mGoingToSleep ||
                shouldListenForFingerprintAssistant() || (mKeyguardOccluded && mIsDreaming))
                && !mSwitchingUser && !isFingerprintDisabled(getCurrentUser())
                && (!mKeyguardGoingAway || !mDeviceInteractive) && mIsPrimaryUser
                && allowedOnBouncer;
        return shouldListen;
        }
    }

    /**