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

Commit f3b8fbdd authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Keyguard shouldn't listen to FP if bouncer showing and keyguard dismissing

There's a race condition if user unlocks from bouncer and an app underneath
uses FP does onResume()

If a user has an application that's authenticating via FP underneath
keyguard and the user dismisses keyguard via bouncer, the app underneath
will get kicked out since onKeyguardVisibilityChanged(false) calls
shouldListenForFingerprint() during this race.

Keyguard shouldn't listen to FP if bouncer is showing but keyguard is
dismissing

Fixes: 37967985
Test: 1) open FP settings
2) enter keyguard and go to bouncer
3) unlock keyguard via pin/pattern/password (NON FP method)
4) tap any finger on sensor (should vibrate)

Change-Id: Ie38d55e6a1ec9b49f9df0c7520d0bc451315c161
parent e048a214
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    private int mRingMode;
    private int mPhoneState;
    private boolean mKeyguardIsVisible;

    private boolean mKeyguardGoingAway;
    private boolean mGoingToSleep;
    private boolean mBouncer;
    private boolean mBootCompleted;
@@ -412,6 +412,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        }
    }

    /**
     * Updates KeyguardUpdateMonitor's internal state to know if keyguard is goingAway
     * @param goingAway
     */
    public void setKeyguardGoingAway(boolean goingAway) {
        mKeyguardGoingAway = goingAway;
    }

    private void onFingerprintAuthenticated(int userId) {
        Trace.beginSection("KeyGuardUpdateMonitor#onFingerPrintAuthenticated");
        mUserFingerprintAuthenticated.put(userId, true);
@@ -1117,7 +1125,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    }

    private boolean shouldListenForFingerprint() {
        return (mKeyguardIsVisible || !mDeviceInteractive || mBouncer || mGoingToSleep)
        return (mKeyguardIsVisible || !mDeviceInteractive ||
                    (mBouncer && !mKeyguardGoingAway) || mGoingToSleep)
                && (!mSwitchingUser && !isFingerprintDisabled(getCurrentUser()) ||
                mEnableNextFingerprint);
    }
+2 −1
Original line number Diff line number Diff line
@@ -1691,7 +1691,6 @@ public class KeyguardViewMediator extends SystemUI {
            mHideAnimationRun = false;
            adjustStatusBarLocked();
            userActivity();

            mShowKeyguardWakeLock.release();
        }
        mKeyguardDisplayManager.show();
@@ -1718,6 +1717,7 @@ public class KeyguardViewMediator extends SystemUI {
                    flags |= WindowManagerPolicy.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER;
                }

                mUpdateMonitor.setKeyguardGoingAway(true /* goingAway */);
                // Don't actually hide the Keyguard at the moment, wait for window
                // manager until it tells us it's safe to do so with
                // startKeyguardExitAnimation.
@@ -1799,6 +1799,7 @@ public class KeyguardViewMediator extends SystemUI {
            adjustStatusBarLocked();
            mDismissCallbackRegistry.notifyDismissSucceeded();
            sendUserPresentBroadcast();
            mUpdateMonitor.setKeyguardGoingAway(false /* goingAway */);
        }
        Trace.endSection();
    }