Dismiss keyguard when simpin auth'd and...

security method is none. This is mostly to fix the case where we auth
sim pin in the set up wizard and it goes straight to keyguard instead of
the setup wizard activity.

This works with the prevent bypass keyguard flag because the device
should be noe secure in this case.

Fixes: 222446076
Test: turn locked sim on, which opens the sim pin screen. Auth the
screen and observe that keyguard is not shown.

Change-Id: Ib2d5400e930fa4d6f7f98e46f32a290ba5f558f4
This commit is contained in:
Aaron Liu
2023-03-28 13:15:04 -07:00
parent 8b8848020d
commit 48fa9bef34
2 changed files with 40 additions and 1 deletions

View File

@@ -753,7 +753,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
case SimPuk: case SimPuk:
// Shortcut for SIM PIN/PUK to go to directly to user's security screen or home // Shortcut for SIM PIN/PUK to go to directly to user's security screen or home
SecurityMode securityMode = mSecurityModel.getSecurityMode(targetUserId); SecurityMode securityMode = mSecurityModel.getSecurityMode(targetUserId);
if (securityMode == SecurityMode.None && mLockPatternUtils.isLockScreenDisabled( if (securityMode == SecurityMode.None || mLockPatternUtils.isLockScreenDisabled(
KeyguardUpdateMonitor.getCurrentUser())) { KeyguardUpdateMonitor.getCurrentUser())) {
finish = true; finish = true;
eventSubtype = BOUNCER_DISMISS_SIM; eventSubtype = BOUNCER_DISMISS_SIM;

View File

@@ -392,6 +392,45 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
.isEqualTo(SecurityMode.PIN); .isEqualTo(SecurityMode.PIN);
} }
@Test
public void showNextSecurityScreenOrFinish_DeviceNotSecure() {
// GIVEN the current security method is SimPin
when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(false);
when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(TARGET_USER_ID)).thenReturn(false);
mKeyguardSecurityContainerController.showSecurityScreen(SecurityMode.SimPin);
// WHEN a request is made from the SimPin screens to show the next security method
when(mKeyguardSecurityModel.getSecurityMode(TARGET_USER_ID)).thenReturn(SecurityMode.None);
mKeyguardSecurityContainerController.showNextSecurityScreenOrFinish(
/* authenticated= */true,
TARGET_USER_ID,
/* bypassSecondaryLockScreen= */true,
SecurityMode.SimPin);
// THEN the next security method of None will dismiss keyguard.
verify(mViewMediatorCallback).keyguardDone(anyBoolean(), anyInt());
}
@Test
public void showNextSecurityScreenOrFinish_DeviceNotSecure_prevent_bypass_on() {
when(mFeatureFlags.isEnabled(Flags.PREVENT_BYPASS_KEYGUARD)).thenReturn(true);
// GIVEN the current security method is SimPin
when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(false);
when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(TARGET_USER_ID)).thenReturn(false);
mKeyguardSecurityContainerController.showSecurityScreen(SecurityMode.SimPin);
// WHEN a request is made from the SimPin screens to show the next security method
when(mKeyguardSecurityModel.getSecurityMode(TARGET_USER_ID)).thenReturn(SecurityMode.None);
mKeyguardSecurityContainerController.showNextSecurityScreenOrFinish(
/* authenticated= */true,
TARGET_USER_ID,
/* bypassSecondaryLockScreen= */true,
SecurityMode.SimPin);
// THEN the next security method of None will dismiss keyguard.
verify(mViewMediatorCallback).keyguardDone(anyBoolean(), anyInt());
}
@Test @Test
public void showNextSecurityScreenOrFinish_ignoresCallWhenSecurityMethodHasChanged() { public void showNextSecurityScreenOrFinish_ignoresCallWhenSecurityMethodHasChanged() {
//GIVEN current security mode has been set to PIN //GIVEN current security mode has been set to PIN