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

Commit b64195e6 authored by Beverly's avatar Beverly
Browse files

Always listen for FP on alternateBouncer showing

Fixes: 268183230
Test: manually test by launching camera over a secure
lock screen with side FP enrolled. try to access
the (locked) camera roll, see alternate FP bouncer and
successfully authenticate from the alternate bouncer
Test: atest KeyguardUpdateMonitorTest

Change-Id: Ic59067f5cdada0ff99b1e8e5e78539ee9ec04e34
parent 6116f0a6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ data class KeyguardFingerprintListenModel(
    override var userId: Int = 0,
    override var listening: Boolean = false,
    // keepSorted
    var alternateBouncerShowing: Boolean = false,
    var biometricEnabledForUser: Boolean = false,
    var bouncerIsOrWillShow: Boolean = false,
    var canSkipBouncer: Boolean = false,
@@ -57,6 +58,7 @@ data class KeyguardFingerprintListenModel(
            userId.toString(),
            listening.toString(),
            // keep sorted
            alternateBouncerShowing.toString(),
            biometricEnabledForUser.toString(),
            bouncerIsOrWillShow.toString(),
            canSkipBouncer.toString(),
@@ -96,6 +98,7 @@ data class KeyguardFingerprintListenModel(
                userId = model.userId
                listening = model.listening
                // keep sorted
                alternateBouncerShowing = model.alternateBouncerShowing
                biometricEnabledForUser = model.biometricEnabledForUser
                bouncerIsOrWillShow = model.bouncerIsOrWillShow
                canSkipBouncer = model.canSkipBouncer
@@ -141,6 +144,7 @@ data class KeyguardFingerprintListenModel(
                "userId",
                "listening",
                // keep sorted
                "alternateBouncerShowing",
                "biometricAllowedForUser",
                "bouncerIsOrWillShow",
                "canSkipBouncer",
+3 −1
Original line number Diff line number Diff line
@@ -2632,6 +2632,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                    ActiveUnlockConfig.ActiveUnlockRequestOrigin.UNLOCK_INTENT,
                    "alternateBouncer");
        }
        updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE);
    }

    private boolean shouldTriggerActiveUnlock() {
@@ -2716,7 +2717,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                        || shouldListenForFingerprintAssistant
                        || (mKeyguardOccluded && mIsDreaming)
                        || (mKeyguardOccluded && userDoesNotHaveTrust
                            && (mOccludingAppRequestingFp || isUdfps));
                            && (mOccludingAppRequestingFp || isUdfps || mAlternateBouncerShowing));

        // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
        // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
@@ -2757,6 +2758,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                    System.currentTimeMillis(),
                    user,
                    shouldListen,
                    mAlternateBouncerShowing,
                    biometricEnabledForUser,
                    mPrimaryBouncerIsOrWillBeShowing,
                    userCanSkipBouncer,
+19 −0
Original line number Diff line number Diff line
@@ -899,6 +899,25 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
                anyBoolean());
    }

    @Test
    public void noFpListeningWhenKeyguardIsOccluded_unlessAlternateBouncerShowing() {
        // GIVEN device is awake but occluded
        mKeyguardUpdateMonitor.dispatchStartedWakingUp(PowerManager.WAKE_REASON_POWER_BUTTON);
        mKeyguardUpdateMonitor.setKeyguardShowing(false, true);

        // THEN fingerprint shouldn't listen
        assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isFalse();
        verify(mFingerprintManager, never()).authenticate(any(), any(), any(), any(), anyInt(),
                anyInt(), anyInt());

        // WHEN alternate bouncer is shown
        mKeyguardUpdateMonitor.setAlternateBouncerShowing(true);

        // THEN make sure FP listening begins
        verify(mFingerprintManager).authenticate(any(), any(), any(), any(), anyInt(), anyInt(),
                anyInt());
    }

    @Test
    public void testTriesToAuthenticate_whenTrustOnAgentKeyguard_ifBypass() {
        mKeyguardUpdateMonitor.dispatchStartedWakingUp(PowerManager.WAKE_REASON_POWER_BUTTON);