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

Commit 19ba208f authored by Lucas Silva's avatar Lucas Silva Committed by Android (Google) Code Review
Browse files

Merge "Prevent keyguard elements from flashing on dream" into main

parents f1fc90bf c7d999fd
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -418,6 +418,25 @@ class KeyguardRootViewModelTest : SysuiTestCase() {
            )
            assertThat(alpha).isEqualTo(0f)

            // Try pulling down shade and ensure the value doesn't change
            shadeRepository.setQsExpansion(0.5f)
            assertThat(alpha).isEqualTo(0f)
        }

    @Test
    fun alpha_idleOnDream_isZero() =
        testScope.runTest {
            val alpha by collectLastValue(underTest.alpha(viewState))
            assertThat(alpha).isEqualTo(1f)

            // Go to GONE state
            keyguardTransitionRepository.sendTransitionSteps(
                from = KeyguardState.LOCKSCREEN,
                to = KeyguardState.DREAMING,
                testScope = testScope,
            )
            assertThat(alpha).isEqualTo(0f)

            // Try pulling down shade and ensure the value doesn't change
            shadeRepository.setQsExpansion(0.5f)
            assertThat(alpha).isEqualTo(0f)
+6 −2
Original line number Diff line number Diff line
@@ -185,8 +185,12 @@ constructor(
                    .transitionValue(OCCLUDED)
                    .map { it == 1f }
                    .onStart { emit(false) },
            ) { isIdleOnCommunal, isGone, isOccluded ->
                isIdleOnCommunal || isGone || isOccluded
                keyguardTransitionInteractor
                    .transitionValue(KeyguardState.DREAMING)
                    .map { it == 1f }
                    .onStart { emit(false) },
            ) { isIdleOnCommunal, isGone, isOccluded, isDreaming ->
                isIdleOnCommunal || isGone || isOccluded || isDreaming
            }
            .distinctUntilChanged()