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

Commit 28969723 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Don't run face auth if device is going to sleep" into tm-qpr-dev am:...

Merge "Don't run face auth if device is going to sleep" into tm-qpr-dev am: e6914146 am: 5e2edb82

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



Change-Id: I5bcde077dfe362e9ce882a4d82171d6522cd910a
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 26d09b20 5e2edb82
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -2575,7 +2575,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        }

        final boolean statusBarShadeLocked = mStatusBarState == StatusBarState.SHADE_LOCKED;
        final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep
        final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive
                && !statusBarShadeLocked;
        final int user = getCurrentUser();
        final int strongAuth = mStrongAuthTracker.getStrongAuthForUser(user);
@@ -2621,7 +2621,7 @@ 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 =
                (mBouncerFullyShown && !mGoingToSleep
                (mBouncerFullyShown
                        || mAuthInterruptActive
                        || mOccludingAppRequestingFace
                        || awakeKeyguard
@@ -2633,6 +2633,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                && strongAuthAllowsScanning && mIsPrimaryUser
                && (!mSecureCameraLaunched || mOccludingAppRequestingFace)
                && !faceAuthenticated
                && !mGoingToSleep
                && !fpOrFaceIsLockedOut;

        // Aggregate relevant fields for debug logging.
+25 −0
Original line number Diff line number Diff line
@@ -1475,6 +1475,27 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue();
    }

    @Test
    public void testShouldListenForFace_udfpsBouncerIsShowingButDeviceGoingToSleep_returnsFalse()
            throws RemoteException {
        // Preconditions for face auth to run
        keyguardNotGoingAway();
        currentUserIsPrimary();
        currentUserDoesNotHaveTrust();
        biometricsNotDisabledThroughDevicePolicyManager();
        biometricsEnabledForCurrentUser();
        userNotCurrentlySwitching();
        deviceNotGoingToSleep();
        mKeyguardUpdateMonitor.setUdfpsBouncerShowing(true);
        mTestableLooper.processAllMessages();
        assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue();

        deviceGoingToSleep();
        mTestableLooper.processAllMessages();

        assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse();
    }

    @Test
    public void testShouldListenForFace_whenFaceIsLockedOut_returnsFalse()
            throws RemoteException {
@@ -1662,6 +1683,10 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        mKeyguardUpdateMonitor.dispatchFinishedGoingToSleep(/* value doesn't matter */1);
    }

    private void deviceGoingToSleep() {
        mKeyguardUpdateMonitor.dispatchStartedGoingToSleep(/* value doesn't matter */1);
    }

    private void deviceIsInteractive() {
        mKeyguardUpdateMonitor.dispatchStartedWakingUp();
    }