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

Commit 8b6f14df authored by Beverly Tai's avatar Beverly Tai Committed by Automerger Merge Worker
Browse files

Merge "Always listen for FP on alternateBouncer showing" into tm-qpr-dev am:...

Merge "Always listen for FP on alternateBouncer showing" into tm-qpr-dev am: 2bb2c5c6 am: 2187bb29

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21417211



Change-Id: Iba09703bd65da4ca49dda0b8a0af1886c4dd7dd3
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 48a81f2a 2187bb29
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
@@ -2648,6 +2648,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                    ActiveUnlockConfig.ActiveUnlockRequestOrigin.UNLOCK_INTENT,
                    "alternateBouncer");
        }
        updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE);
    }

    private boolean shouldTriggerActiveUnlock() {
@@ -2732,7 +2733,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.
@@ -2773,6 +2774,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
@@ -908,6 +908,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);