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

Commit 0e500d92 authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

From dream, FP auth brings you to the last app

Instead of dismissing the activity and bringing
the user to the home screen/launcher.

Test: atest OccludingAppDeviceEntryInteractorTest
Test: use an app and then wait for timeout to dream. When
authenticating with SFPS from the dream, the last app
shows after authentication
Bug: 302196044

Change-Id: I404b2bcaea4e88c9e217c2565af9cd55770dc88c
parent 7831be92
Loading
Loading
Loading
Loading
+11 −6
Original line number Original line Diff line number Diff line
@@ -91,12 +91,17 @@ constructor(


    init {
    init {
        scope.launch {
        scope.launch {
            // On fingerprint success when the screen is on, go to the home screen
            // On fingerprint success when the screen is on and not dreaming, go to the home screen
            fingerprintUnlockSuccessEvents.sample(powerInteractor.isInteractive).collect {
            fingerprintUnlockSuccessEvents
                if (it) {
                .sample(
                    combine(powerInteractor.isInteractive, keyguardInteractor.isDreaming, ::Pair),
                )
                .collect { (interactive, dreaming) ->
                    if (interactive && !dreaming) {
                        goToHomeScreen()
                        goToHomeScreen()
                    }
                    }
                // don't go to the home screen if the authentication is from AOD/dozing/off
                    // don't go to the home screen if the authentication is from
                    // AOD/dozing/off/dreaming
                }
                }
        }
        }


+13 −0
Original line number Original line Diff line number Diff line
@@ -180,6 +180,18 @@ class OccludingAppDeviceEntryInteractorTest : SysuiTestCase() {
            verifyNeverGoToHomeScreen()
            verifyNeverGoToHomeScreen()
        }
        }


    @Test
    fun fingerprintSuccess_dreaming_doesNotGoToHomeScreen() =
        testScope.runTest {
            givenOnOccludingApp(true)
            keyguardRepository.setDreaming(true)
            fingerprintAuthRepository.setAuthenticationStatus(
                SuccessFingerprintAuthenticationStatus(0, true)
            )
            runCurrent()
            verifyNeverGoToHomeScreen()
        }

    @Test
    @Test
    fun fingerprintSuccess_notOnOccludingApp_doesNotGoToHomeScreen() =
    fun fingerprintSuccess_notOnOccludingApp_doesNotGoToHomeScreen() =
        testScope.runTest {
        testScope.runTest {
@@ -315,6 +327,7 @@ class OccludingAppDeviceEntryInteractorTest : SysuiTestCase() {
        powerRepository.setInteractive(true)
        powerRepository.setInteractive(true)
        keyguardRepository.setKeyguardOccluded(isOnOccludingApp)
        keyguardRepository.setKeyguardOccluded(isOnOccludingApp)
        keyguardRepository.setKeyguardShowing(isOnOccludingApp)
        keyguardRepository.setKeyguardShowing(isOnOccludingApp)
        keyguardRepository.setDreaming(false)
        bouncerRepository.setPrimaryShow(!isOnOccludingApp)
        bouncerRepository.setPrimaryShow(!isOnOccludingApp)
        bouncerRepository.setAlternateVisible(!isOnOccludingApp)
        bouncerRepository.setAlternateVisible(!isOnOccludingApp)
    }
    }