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

Commit 17339f34 authored by Chandru S's avatar Chandru S
Browse files

Restart any pending bouncer lockout when device boots up.

Fixes: 358594612
Flag: com.android.systemui.scene_container
Test: atest BouncerMessageViewModelTest
Test: manually,
 1. try incorrect pin for 10 times to start a 300 second lockout timer.
 2. restart the device
 3. Go to bouncer, lockout timer should continue showing seconds left in lockdown
Change-Id: I3cf427b3ac69ebcfa04de4dff1136e9ebec5d50a
parent e5850ff0
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -430,6 +430,22 @@ class BouncerMessageViewModelTest : SysuiTestCase() {
                .isEqualTo("Can’t unlock with face. Too many attempts.")
        }

    @Test
    fun startLockdownCountdown_onActivated() =
        testScope.runTest {
            val bouncerMessage by collectLastValue(underTest.message)
            val lockoutSeconds = 200 * 1000 // 200 second lockout
            kosmos.fakeAuthenticationRepository.setAuthenticationMethod(Pin)
            kosmos.fakeAuthenticationRepository.reportLockoutStarted(lockoutSeconds)
            runCurrent()

            assertThat(bouncerMessage?.text).isEqualTo("Try again in 200 seconds.")
            advanceTimeBy(100.seconds)
            assertThat(bouncerMessage?.text).isEqualTo("Try again in 100 seconds.")
            advanceTimeBy(101.seconds)
            assertThat(bouncerMessage?.text).isEqualTo("Enter PIN")
        }

    private fun TestScope.verifyMessagesForAuthFlags(
        vararg authFlagToMessagePair: Pair<Int, Pair<String, String?>>
    ) {
+3 −0
Original line number Diff line number Diff line
@@ -264,6 +264,9 @@ constructor(
            // Keeps the lockout message up-to-date.
            launch { bouncerInteractor.onLockoutStarted.collect { startLockoutCountdown() } }

            // Start already active lockdown if it exists
            launch { startLockoutCountdown() }

            // Listens to relevant bouncer events
            launch {
                bouncerInteractor.onIncorrectBouncerInput