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

Commit 2d8da3d0 authored by Coco Duan's avatar Coco Duan
Browse files

Use isDreaming signal for Gone->Dream transition

Power button press over launcher sometimes(apps drawer open)
causes keyguard clock to briefly appear. The transition is
Gone->Lockscreen->Dream instead of Gone->Dream due to
isAbleToDream's 500ms delay.

Directly using isDreaming for Gone->Dream fixes the issue and
should be safe as isAbleToDream is intended for delay checking
dreaming info after exiting AOD. And powerInteractor.asleep
arrives early and triggers Gone->AOD correctly when AOD enabled.

Fixes: b/372563526
Flag: EXEMPT bugfix
Test: verify dream/doze/AOD transition by pressing power button over launcher
Change-Id: I8c81eb2e08ba89c935dd9e496a0ad92260fa3b4d
parent 8c68933c
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -567,9 +567,6 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest
    @DisableSceneContainer
    fun goneToDreaming() =
        testScope.runTest {
            // Setup - Move past initial delay with [KeyguardInteractor#isAbleToDream]
            advanceTimeBy(600L)

            // GIVEN a prior transition has run to GONE
            runTransitionAndSetWakefulness(KeyguardState.LOCKSCREEN, KeyguardState.GONE)

+2 −2
Original line number Diff line number Diff line
@@ -136,8 +136,8 @@ constructor(

    private fun listenForGoneToDreaming() {
        scope.launch("$TAG#listenForGoneToDreaming") {
            keyguardInteractor.isAbleToDream
                .filterRelevantKeyguardStateAnd { isAbleToDream -> isAbleToDream }
            keyguardInteractor.isDreaming
                .filterRelevantKeyguardStateAnd { isDreaming -> isDreaming }
                .collect { startTransitionTo(KeyguardState.DREAMING) }
        }
    }