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

Commit c7d999fd authored by Lucas Silva's avatar Lucas Silva
Browse files

Prevent keyguard elements from flashing on dream

Hide keyguard on dream, similar to know its hidden on OCCLUDED and GONE
states.

Fixes: 333414848
Test: atest KeyguardRootViewModelTest
Flag: NA
Change-Id: Iaae0c59ff92e8fef2bdf6e7f1311c4f816b47862
parent 869e636a
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -422,6 +422,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()