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

Commit 52732848 authored by Josh Tsuji's avatar Josh Tsuji Committed by Android (Google) Code Review
Browse files

Merge "Fix isNotificationLaunchAnimationRunningOnKeyguard." into main

parents 50f9f5c6 7149fac7
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart

/**
 * Distance over which the surface behind the keyguard is animated in during a Y-translation
@@ -102,8 +103,11 @@ constructor(
     */
    private val isNotificationLaunchAnimationRunningOnKeyguard =
        notificationLaunchInteractor.isLaunchAnimationRunning
            .sample(transitionInteractor.finishedKeyguardState)
            .map { it != KeyguardState.GONE }
            .sample(transitionInteractor.finishedKeyguardState, ::Pair)
            .map { (animationRunning, finishedState) ->
                animationRunning && finishedState != KeyguardState.GONE
            }
            .onStart { emit(false) }

    /**
     * Whether we're animating the surface, or a notification launch animation is running (which
+23 −0
Original line number Diff line number Diff line
@@ -274,4 +274,27 @@ class KeyguardSurfaceBehindInteractorTest : SysuiTestCase() {
            runCurrent()
            assertThat(isAnimatingSurface).isFalse()
        }

    @Test
    fun notificationLaunchFalse_isAnimatingSurfaceFalse() =
        testScope.runTest {
            val isAnimatingSurface by collectLastValue(underTest.isAnimatingSurface)
            transitionRepository.sendTransitionStep(
                TransitionStep(
                    from = KeyguardState.AOD,
                    to = KeyguardState.LOCKSCREEN,
                    transitionState = TransitionState.STARTED,
                )
            )
            transitionRepository.sendTransitionStep(
                TransitionStep(
                    from = KeyguardState.AOD,
                    to = KeyguardState.LOCKSCREEN,
                    transitionState = TransitionState.FINISHED,
                )
            )
            kosmos.notificationLaunchAnimationInteractor.setIsLaunchAnimationRunning(false)
            runCurrent()
            assertThat(isAnimatingSurface).isFalse()
        }
}