summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chandru <chandruis@google.com> 2022-10-04 13:01:00 +0000
committer Chandru <chandruis@google.com> 2022-10-05 10:23:01 +0000
commit6cd2a57e3f008cbc08ab84a5e4ea91afefb9c28f (patch)
tree835157be033ce79bcf6500fc13e2a0a7b796a33a
parent580e951458f21438580a53b14a9bdf6c2e683eb8 (diff)
Don't run face auth if device is going to sleep
Fixes: 245475936 Test: atest KeyguardUpdateMonitorTest Test: Tested manually: enroll FP & face, lock phone, tap on weather in smart space on lock screen to show UDFPS bouncer, wait for screen timeout, face auth shouldn't run just before screen turns off Change-Id: I34f626322265f85abc112c9cfd4d3d957229bb1a
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java5
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java25
2 files changed, 28 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index f5b27dddedd7..d14666de4b3e 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -2589,7 +2589,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);
@@ -2635,7 +2635,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
@@ -2647,6 +2647,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
&& strongAuthAllowsScanning && mIsPrimaryUser
&& (!mSecureCameraLaunched || mOccludingAppRequestingFace)
&& !faceAuthenticated
+ && !mGoingToSleep
&& !fpOrFaceIsLockedOut;
// Aggregate relevant fields for debug logging.
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
index 46226ef01e8d..9aa71e9106ac 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
@@ -1475,6 +1475,27 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
}
@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 {
// Preconditions for face auth to run
@@ -1661,6 +1682,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();
}