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

Commit c27380d1 authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "Tweak to isOnLockscreen" into main

parents 480453dd f2fd2eb5
Loading
Loading
Loading
Loading
+39 −0
Original line number Original line Diff line number Diff line
@@ -635,6 +635,45 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S
            assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f))
            assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f))
        }
        }


    @Test
    @DisableSceneContainer
    fun boundsStableWhenGoingToAlternateBouncer() =
        testScope.runTest {
            val bounds by collectLastValue(underTest.bounds)

            // Start on lockscreen
            showLockscreen()

            keyguardInteractor.setNotificationContainerBounds(
                NotificationContainerBounds(top = 1f, bottom = 2f)
            )

            assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f))

            // Begin transition to AOD
            keyguardTransitionRepository.sendTransitionStep(
                TransitionStep(LOCKSCREEN, ALTERNATE_BOUNCER, 0f, TransitionState.STARTED)
            )
            runCurrent()
            keyguardTransitionRepository.sendTransitionStep(
                TransitionStep(LOCKSCREEN, ALTERNATE_BOUNCER, 0f, TransitionState.RUNNING)
            )
            runCurrent()

            // This is the last step before FINISHED is sent, which could trigger a change in bounds
            keyguardTransitionRepository.sendTransitionStep(
                TransitionStep(LOCKSCREEN, ALTERNATE_BOUNCER, 1f, TransitionState.RUNNING)
            )
            runCurrent()
            assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f))

            keyguardTransitionRepository.sendTransitionStep(
                TransitionStep(LOCKSCREEN, ALTERNATE_BOUNCER, 1f, TransitionState.FINISHED)
            )
            runCurrent()
            assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f))
        }

    @Test
    @Test
    @DisableSceneContainer
    @DisableSceneContainer
    fun boundsDoNotChangeWhileLockscreenToAodTransitionIsActive() =
    fun boundsDoNotChangeWhileLockscreenToAodTransitionIsActive() =
+9 −7
Original line number Original line Diff line number Diff line
@@ -221,13 +221,15 @@ constructor(
    /** If the user is visually on one of the unoccluded lockscreen states. */
    /** If the user is visually on one of the unoccluded lockscreen states. */
    val isOnLockscreen: Flow<Boolean> =
    val isOnLockscreen: Flow<Boolean> =
        anyOf(
        anyOf(
                keyguardTransitionInteractor.isFinishedIn(AOD),
                keyguardTransitionInteractor.transitionValue(AOD).map { it > 0f },
                keyguardTransitionInteractor.isFinishedIn(DOZING),
                keyguardTransitionInteractor.transitionValue(DOZING).map { it > 0f },
                keyguardTransitionInteractor.isFinishedIn(ALTERNATE_BOUNCER),
                keyguardTransitionInteractor.transitionValue(ALTERNATE_BOUNCER).map { it > 0f },
                keyguardTransitionInteractor.isFinishedIn(
                keyguardTransitionInteractor
                    .transitionValue(
                        scene = Scenes.Bouncer,
                        scene = Scenes.Bouncer,
                        stateWithoutSceneContainer = PRIMARY_BOUNCER,
                        stateWithoutSceneContainer = PRIMARY_BOUNCER,
                ),
                    )
                    .map { it > 0f },
                keyguardTransitionInteractor.transitionValue(LOCKSCREEN).map { it > 0f },
                keyguardTransitionInteractor.transitionValue(LOCKSCREEN).map { it > 0f },
            )
            )
            .flowName("isOnLockscreen")
            .flowName("isOnLockscreen")