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

Commit 1b8815ba authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Implement transition from alternate bouncer -> dreaming" into main

parents 27585a46 9d9f12b4
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -228,6 +228,39 @@ class FromAlternateBouncerTransitionInteractorTest(flags: FlagsParameterization)
            Truth.assertThat(currentScene).isEqualTo(CommunalScenes.Blank)
        }

    @Test
    @EnableFlags(FLAG_GLANCEABLE_HUB_V2)
    fun transitionToDreaming() =
        kosmos.runTest {
            fakePowerRepository.updateWakefulness(
                WakefulnessState.AWAKE,
                WakeSleepReason.POWER_BUTTON,
                WakeSleepReason.POWER_BUTTON,
                false,
            )
            fakeKeyguardRepository.setKeyguardOccluded(false)
            fakeKeyguardBouncerRepository.setAlternateVisible(true)
            runCurrent()

            transitionRepository.sendTransitionSteps(
                from = KeyguardState.LOCKSCREEN,
                to = KeyguardState.ALTERNATE_BOUNCER,
                testScope,
            )
            reset(transitionRepository)

            fakeKeyguardRepository.setKeyguardOccluded(true)
            fakeKeyguardRepository.setDreaming(true)
            fakeKeyguardBouncerRepository.setAlternateVisible(false)
            testScope.advanceTimeBy(200) // advance past delay

            assertThat(transitionRepository)
                .startedTransition(
                    from = KeyguardState.ALTERNATE_BOUNCER,
                    to = KeyguardState.DREAMING,
                )
        }

    @Test
    @DisableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR)
    fun transitionToGone_whenOpeningGlanceableHubEditMode() =
+8 −13
Original line number Diff line number Diff line
@@ -118,26 +118,19 @@ constructor(
                    powerInteractor.isAwake,
                    keyguardInteractor.isAodAvailable,
                    communalSceneInteractor.isIdleOnCommunal,
                    communalInteractor.editModeOpen,
                    keyguardInteractor.isDreaming,
                    keyguardInteractor.isKeyguardOccluded,
                )
                .filterRelevantKeyguardStateAnd {
                    (isAlternateBouncerShowing, isPrimaryBouncerShowing, _, _, _) ->
                    (isAlternateBouncerShowing, isPrimaryBouncerShowing, _, _, _, _) ->
                    !isAlternateBouncerShowing && !isPrimaryBouncerShowing
                }
                .collect {
                    (
                        _,
                        _,
                        isAwake,
                        isAodAvailable,
                        isIdleOnCommunal,
                        isCommunalEditMode,
                        isOccluded) ->
                .collect { (_, _, isAwake, isAodAvailable, isIdleOnCommunal, isDreaming, isOccluded)
                    ->
                    // When unlocking over glanceable hub to enter edit mode, transitioning directly
                    // to GONE prevents the lockscreen flash. Let listenForAlternateBouncerToGone
                    // handle it.
                    if (isCommunalEditMode) return@collect
                    if (communalInteractor.editModeOpen.value) return@collect
                    val hubV2 = communalSettingsInteractor.isV2FlagEnabled()
                    val to =
                        if (!isAwake) {
@@ -150,8 +143,10 @@ constructor(
                            if (!hubV2 && isIdleOnCommunal) {
                                if (SceneContainerFlag.isEnabled) return@collect
                                KeyguardState.GLANCEABLE_HUB
                            } else if (isOccluded) {
                            } else if (isOccluded && !isDreaming) {
                                KeyguardState.OCCLUDED
                            } else if (hubV2 && isDreaming) {
                                KeyguardState.DREAMING
                            } else if (hubV2 && isIdleOnCommunal) {
                                if (SceneContainerFlag.isEnabled) return@collect
                                KeyguardState.GLANCEABLE_HUB