Merge "Display SIM PIN immediately when inserted on unlocked lockscreen" into main
diff --git a/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.kt
index 5fe5cb3..1841d2e 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.kt
@@ -623,6 +623,22 @@
}
@Test
+ fun showNextSecurityScreenOrFinish_calledWithNoAuthentication_butRequiresSimPin() {
+ // GIVEN trust is true (extended unlock)
+ whenever(keyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(true)
+
+ // WHEN SIMPIN is the next required screen
+ whenever(keyguardSecurityModel.getSecurityMode(TARGET_USER_ID))
+ .thenReturn(SecurityMode.SimPin)
+
+ // WHEN a request is made to dismiss
+ underTest.dismiss(TARGET_USER_ID)
+
+ // THEN we will show the SIM PIN screen
+ verify(viewFlipperController).getSecurityView(eq(SecurityMode.SimPin), any(), any())
+ }
+
+ @Test
fun onSwipeUp_forwardsItToFaceAuthInteractor() {
val registeredSwipeListener = registeredSwipeListener
setupGetSecurityView(SecurityMode.Password)
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
index e564626..8cfb4c5 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
@@ -897,6 +897,18 @@
break;
}
}
+ // A check to dismiss was made without any authentication. Verify there are no remaining SIM
+ // screens, which may happen on an unlocked lockscreen
+ if (!authenticated) {
+ SecurityMode securityMode = mSecurityModel.getSecurityMode(targetUserId);
+ if (Arrays.asList(SimPin, SimPuk).contains(securityMode)) {
+ Log.v(TAG, "Dismiss called but SIM/PUK unlock screen still required");
+ eventSubtype = -1;
+ showSecurityScreen(securityMode);
+ finish = false;
+ }
+ }
+
// Check for device admin specified additional security measures.
if (finish && !bypassSecondaryLockScreen) {
Intent secondaryLockscreenIntent =