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

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

Change-Id: Ia0dd6ce8c572777da42a189f60965c28d4ca9445
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2022-10-05 18:34:50 +00:00
committed by Automerger Merge Worker
2 changed files with 28 additions and 2 deletions

View File

@@ -2589,7 +2589,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
} }
final boolean statusBarShadeLocked = mStatusBarState == StatusBarState.SHADE_LOCKED; final boolean statusBarShadeLocked = mStatusBarState == StatusBarState.SHADE_LOCKED;
final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive
&& !statusBarShadeLocked; && !statusBarShadeLocked;
final int user = getCurrentUser(); final int user = getCurrentUser();
final int strongAuth = mStrongAuthTracker.getStrongAuthForUser(user); final int strongAuth = mStrongAuthTracker.getStrongAuthForUser(user);
@@ -2635,7 +2635,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
// Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware. // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
final boolean shouldListen = final boolean shouldListen =
(mBouncerFullyShown && !mGoingToSleep (mBouncerFullyShown
|| mAuthInterruptActive || mAuthInterruptActive
|| mOccludingAppRequestingFace || mOccludingAppRequestingFace
|| awakeKeyguard || awakeKeyguard
@@ -2647,6 +2647,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
&& strongAuthAllowsScanning && mIsPrimaryUser && strongAuthAllowsScanning && mIsPrimaryUser
&& (!mSecureCameraLaunched || mOccludingAppRequestingFace) && (!mSecureCameraLaunched || mOccludingAppRequestingFace)
&& !faceAuthenticated && !faceAuthenticated
&& !mGoingToSleep
&& !fpOrFaceIsLockedOut; && !fpOrFaceIsLockedOut;
// Aggregate relevant fields for debug logging. // Aggregate relevant fields for debug logging.

View File

@@ -1474,6 +1474,27 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue(); 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 @Test
public void testShouldListenForFace_whenFaceIsLockedOut_returnsFalse() public void testShouldListenForFace_whenFaceIsLockedOut_returnsFalse()
throws RemoteException { throws RemoteException {
@@ -1661,6 +1682,10 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
mKeyguardUpdateMonitor.dispatchFinishedGoingToSleep(/* value doesn't matter */1); mKeyguardUpdateMonitor.dispatchFinishedGoingToSleep(/* value doesn't matter */1);
} }
private void deviceGoingToSleep() {
mKeyguardUpdateMonitor.dispatchStartedGoingToSleep(/* value doesn't matter */1);
}
private void deviceIsInteractive() { private void deviceIsInteractive() {
mKeyguardUpdateMonitor.dispatchStartedWakingUp(); mKeyguardUpdateMonitor.dispatchStartedWakingUp();
} }