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

Commit 14a320dc authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "From dream, FP auth brings you to the last app" into main

parents 85c13088 0e500d92
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)
    }
    }