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

Commit 3119a18f authored by Steve Kondik's avatar Steve Kondik Committed by Bruno Martins
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 0bf7226d
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
<!--
     Copyright (C) 2018 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.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<resources>
    <!-- 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
@@ -232,6 +232,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    private boolean mIsDreaming;
    private final DevicePolicyManager mDevicePolicyManager;
    private boolean mLogoutEnabled;
    private final boolean mFingerprintWakeAndUnlock;

    /**
     * Short delay before restarting fingerprint authentication after a successful try
@@ -1168,6 +1169,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...
@@ -1271,12 +1274,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) {