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

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

Merge "Update definition of occludingAppOnKeyguard" into main

parents ca5e3d42 f53ed282
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -74,8 +74,13 @@ constructor(
                    keyguardInteractor.isKeyguardShowing,
                    primaryBouncerInteractor.isShowing,
                    alternateBouncerInteractor.isVisible,
                ) { occluded, showing, primaryBouncerShowing, alternateBouncerVisible ->
                    occluded && showing && !primaryBouncerShowing && !alternateBouncerVisible
                    keyguardInteractor.isDozing,
                ) { occluded, showing, primaryBouncerShowing, alternateBouncerVisible, dozing ->
                    occluded &&
                        showing &&
                        !primaryBouncerShowing &&
                        !alternateBouncerVisible &&
                        !dozing
                }
                .distinctUntilChanged()
        }
+34 −0
Original line number Diff line number Diff line
@@ -221,8 +221,42 @@ class OccludingAppDeviceEntryInteractorTest : SysuiTestCase() {
            assertThat(message).isNull()
        }

    @Test
    fun noMessage_fpErrorsWhileDozing() =
        testScope.runTest {
            val message by collectLastValue(underTest.message)

            givenOnOccludingApp(true)
            givenFingerprintAllowed(true)
            keyguardRepository.setIsDozing(true)
            runCurrent()

            // ERROR message
            fingerprintAuthRepository.setAuthenticationStatus(
                ErrorFingerprintAuthenticationStatus(
                    FingerprintManager.FINGERPRINT_ERROR_HW_UNAVAILABLE,
                    "testError",
                )
            )
            assertThat(message).isNull()

            // HELP message
            fingerprintAuthRepository.setAuthenticationStatus(
                HelpFingerprintAuthenticationStatus(
                    FingerprintManager.FINGERPRINT_ACQUIRED_PARTIAL,
                    "testHelp",
                )
            )
            assertThat(message).isNull()

            // FAIL message
            fingerprintAuthRepository.setAuthenticationStatus(FailFingerprintAuthenticationStatus)
            assertThat(message).isNull()
        }

    private fun givenOnOccludingApp(isOnOccludingApp: Boolean) {
        powerRepository.setInteractive(true)
        keyguardRepository.setIsDozing(false)
        keyguardRepository.setKeyguardOccluded(isOnOccludingApp)
        keyguardRepository.setKeyguardShowing(isOnOccludingApp)
        keyguardRepository.setDreaming(false)