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

Commit 87079fe6 authored by Matt Pietal's avatar Matt Pietal
Browse files

Fix keyguard flicker on QR code launch

For some reason this was very reproducible only with
this activity. Ensure alpha won't show during transition.

Fixes: 366022169
Test: atest KeyguardRootViewModelTest
Flag: com.android.systemui.migrate_clocks_to_blueprint
Change-Id: Iec51a50555512996783756830864a5793b90c974
parent 2a441691
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
@@ -505,6 +505,46 @@ class KeyguardRootViewModelTest(flags: FlagsParameterization) : SysuiTestCase()
            assertThat(alpha).isEqualTo(1f)
        }

    @Test
    @DisableSceneContainer
    fun alphaFromShadeExpansion_doesNotEmitWhenOccludedTransitionRunning() =
        testScope.runTest {
            keyguardTransitionRepository.sendTransitionSteps(
                from = KeyguardState.AOD,
                to = KeyguardState.LOCKSCREEN,
                testScope,
            )

            val alpha by collectLastValue(underTest.alpha(viewState))
            shadeTestUtil.setQsExpansion(0f)
            runCurrent()
            assertThat(alpha).isEqualTo(1f)

            keyguardTransitionRepository.sendTransitionSteps(
                listOf(
                    TransitionStep(
                        from = KeyguardState.LOCKSCREEN,
                        to = KeyguardState.OCCLUDED,
                        transitionState = TransitionState.STARTED,
                        value = 0f,
                    ),
                    TransitionStep(
                        from = KeyguardState.LOCKSCREEN,
                        to = KeyguardState.OCCLUDED,
                        transitionState = TransitionState.RUNNING,
                        value = 0.8f,
                    ),
                ),
                testScope,
            )
            // Alpha should be 0f from the above transition
            assertThat(alpha).isEqualTo(0f)

            shadeTestUtil.setQsExpansion(0.5f)
            // Alpha should remain unchanged
            assertThat(alpha).isEqualTo(0f)
        }

    @Test
    @DisableSceneContainer
    fun alphaFromShadeExpansion_doesNotEmitWhenLockscreenToDreamTransitionRunning() =
+4 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardState.AOD
import com.android.systemui.keyguard.shared.model.KeyguardState.DREAMING
import com.android.systemui.keyguard.shared.model.KeyguardState.GONE
import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN
import com.android.systemui.keyguard.shared.model.KeyguardState.OCCLUDED
import com.android.systemui.keyguard.shared.model.KeyguardState.PRIMARY_BOUNCER
import com.android.systemui.keyguard.shared.model.TransitionState.RUNNING
import com.android.systemui.keyguard.shared.model.TransitionState.STARTED
@@ -174,6 +175,9 @@ constructor(
                    keyguardTransitionInteractor.isInTransition(
                        Edge.create(from = LOCKSCREEN, to = DREAMING)
                    ),
                    keyguardTransitionInteractor.isInTransition(
                        Edge.create(from = LOCKSCREEN, to = OCCLUDED)
                    ),
                ),
                isOnLockscreen,
                shadeInteractor.qsExpansion,