Don't listen for udfps on lock down or encryption

If the device is encryped or is in lock down, don't show the udfps
overlay because the user cannot authenticate from this state anyway.

Test: atest KeyguardUpdateMonitorTest
Fixes: 183629563
Change-Id: Ie48dfa6bc4a5db0a35be02fd973d982ef3475315
This commit is contained in:
Beverly
2021-04-01 13:26:29 -04:00
committed by Beverly Tai
parent 726db03ea1
commit ceeacda56f
2 changed files with 16 additions and 0 deletions

View File

@@ -2113,6 +2113,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
return shouldListenForFingerprint()
&& !mBouncer
&& !getUserCanSkipBouncer(getCurrentUser())
&& !isEncryptedOrLockdown(getCurrentUser())
&& mStrongAuthTracker.hasUserAuthenticatedSinceBoot();
}

View File

@@ -910,6 +910,21 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
assertThat(mKeyguardUpdateMonitor.shouldListenForUdfps()).isEqualTo(false);
}
@Test
public void testShouldNotListenForUdfps_whenInLockDown() {
// GIVEN a "we should listen for udfps" state
setKeyguardBouncerVisibility(false /* isVisible */);
mStatusBarStateListener.onStateChanged(StatusBarState.KEYGUARD);
when(mStrongAuthTracker.hasUserAuthenticatedSinceBoot()).thenReturn(true);
// WHEN device in lock down
when(mStrongAuthTracker.getStrongAuthForUser(anyInt())).thenReturn(
KeyguardUpdateMonitor.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN);
// THEN we shouldn't listen for udfps
assertThat(mKeyguardUpdateMonitor.shouldListenForUdfps()).isEqualTo(false);
}
@Test
public void testRequireUnlockForNfc_Broadcast() {
KeyguardUpdateMonitorCallback callback = mock(KeyguardUpdateMonitorCallback.class);