Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 064abbaf authored by Matt Pietal's avatar Matt Pietal
Browse files

Display SIM PIN immediately when inserted on unlocked lockscreen

When the user has swipe security or has authenticated with face
auth without bypass, insert a SIM. Previously, this reset the
keyguard which had the side effect of calling dismiss and going
to GONE.

On a call to dismiss(), check first whether any SIM screens
remain.

Fixes: 374660035
Test: atest KeyguardSecurityContainerControllerTest
Flag: EXEMPT bugfix
Change-Id: Ia3000dc806045b2a6b9ab3bec74e231395c5aa61
parent 3c6c3f7c
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -622,6 +622,22 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
        verify(viewFlipperController).getSecurityView(eq(SecurityMode.SimPin), any(), any())
    }

    @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
+12 −0
Original line number Diff line number Diff line
@@ -897,6 +897,18 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
                    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 =