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

Commit 963b552a authored by Josh Tsuji's avatar Josh Tsuji
Browse files

[keyguard_wm_state_refactor] Fix flickering on canceled screen off.

That debounce does not seem necessary with the flag enabled (I tested all AOD -> awake race conditions), and it causes a ton of issues when the WM state is tied to that transition (you see a black screen for 50ms+).

Additionally, starting the AOD transition from LAST_VALUE was causing a single frame of transitionValue(AOD)==1f, which caused an unwanted setLockScreenShown(aodVisible=true) call.

Bug: 278086361
Flag: com.android.systemui.keyguard_wm_state_refactor
Test: manual
Change-Id: Icf5306ccb12ca356f2aa146ee36de915e25d1ea3
parent 177bd9fc
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -302,12 +302,7 @@ class FromAodTransitionInteractorTest : SysuiTestCase() {
            powerInteractor.setAwakeForTest()
            runCurrent()

            // Waking up from wake and unlock should not start any transitions, we'll wait for the
            // dismiss call.
            assertThat(transitionRepository).noTransitionsStarted()

            underTest.dismissAod()
            advanceTimeBy(100) // account for debouncing

            assertThat(transitionRepository)
                .startedTransition(from = KeyguardState.AOD, to = KeyguardState.GONE)
@@ -325,12 +320,7 @@ class FromAodTransitionInteractorTest : SysuiTestCase() {
            powerInteractor.setAwakeForTest()
            runCurrent()

            // Waking up from wake and unlock should not start any transitions, we'll wait for the
            // dismiss call.
            assertThat(transitionRepository).noTransitionsStarted()

            underTest.dismissAod()
            advanceTimeBy(100) // account for debouncing

            assertThat(transitionRepository)
                .startedTransition(from = KeyguardState.AOD, to = KeyguardState.GONE)
+11 −4
Original line number Diff line number Diff line
@@ -93,7 +93,13 @@ constructor(
        // transition.
        scope.launch("$TAG#listenForAodToAwake") {
            powerInteractor.detailedWakefulness
                .debounce(50L)
                .apply {
                    if (!KeyguardWmStateRefactor.isEnabled) {
                        // This works around some timing issues pre-refactor that are no longer an
                        // issue (and this causes problems with the flag enabled).
                        debounce(50L)
                    }
                }
                .filterRelevantKeyguardStateAnd { wakefulness -> wakefulness.isAwake() }
                .sample(wakeToGoneInteractor.canWakeDirectlyToGone, ::Pair)
                .collect {
@@ -155,10 +161,11 @@ constructor(
                            )
                        } else if (shouldTransitionToLockscreen) {
                            val modeOnCanceled =
                                if (startedStep.from == KeyguardState.LOCKSCREEN) {
                                if (
                                    startedStep.from == KeyguardState.LOCKSCREEN ||
                                        startedStep.from == KeyguardState.GONE
                                ) {
                                    TransitionModeOnCanceled.REVERSE
                                } else if (startedStep.from == KeyguardState.GONE) {
                                    TransitionModeOnCanceled.RESET
                                } else {
                                    TransitionModeOnCanceled.LAST_VALUE
                                }