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

Commit e3b61005 authored by Matt Pietal's avatar Matt Pietal
Browse files

Reset keyguard y translation

Since it still relies on legacy shade expansion, make sure
to handle values of 1f when not transitioning to GONE.

Fixes: 339718087
Test: atest KeyguardInteractorTest
Flag: ACONFIG com.android.systemui.migrate_clocks_to_blueprint
TEAMFOOD

Change-Id: Ibd29ad1725be59f62a876d9f6571ef14f12fe4ce
parent 5afbd0f4
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -274,6 +274,28 @@ class KeyguardInteractorTest : SysuiTestCase() {
            assertThat(keyguardTranslationY).isEqualTo(0f)
        }

    @Test
    fun keyguardTranslationY_whenNotGoneAndShadeIsReesetEmitsZero() =
        testScope.runTest {
            val keyguardTranslationY by collectLastValue(underTest.keyguardTranslationY)

            configRepository.setDimensionPixelSize(
                R.dimen.keyguard_translate_distance_on_swipe_up,
                100
            )
            configRepository.onAnyConfigurationChange()

            shadeRepository.setLegacyShadeExpansion(1f)

            keyguardTransitionRepository.sendTransitionSteps(
                from = KeyguardState.AOD,
                to = KeyguardState.LOCKSCREEN,
                testScope,
            )

            assertThat(keyguardTranslationY).isEqualTo(0f)
        }

    @Test
    fun keyguardTranslationY_whenTransitioningToGoneAndShadeIsExpandingEmitsNonZero() =
        testScope.runTest {
+9 −3
Original line number Diff line number Diff line
@@ -182,7 +182,11 @@ constructor(
            }
            .sample(powerInteractor.isAwake) { isAbleToDream, isAwake -> isAbleToDream && isAwake }
            .debounce(50L)
            .distinctUntilChanged()
            .stateIn(
                scope = applicationScope,
                started = SharingStarted.WhileSubscribed(),
                initialValue = false,
            )

    /** Whether the keyguard is showing or not. */
    @Deprecated("Use KeyguardTransitionInteractor + KeyguardState")
@@ -314,10 +318,12 @@ constructor(
                    shadeRepository.legacyShadeExpansion.onStart { emit(0f) },
                    keyguardTransitionInteractor.transitionValue(GONE).onStart { emit(0f) },
                ) { legacyShadeExpansion, goneValue ->
                    if (goneValue == 1f || (goneValue == 0f && legacyShadeExpansion == 0f)) {
                    val isLegacyShadeInResetPosition =
                        legacyShadeExpansion == 0f || legacyShadeExpansion == 1f
                    if (goneValue == 1f || (goneValue == 0f && isLegacyShadeInResetPosition)) {
                        // Reset the translation value
                        emit(0f)
                    } else if (legacyShadeExpansion > 0f && legacyShadeExpansion < 1f) {
                    } else if (!isLegacyShadeInResetPosition) {
                        // On swipe up, translate the keyguard to reveal the bouncer, OR a GONE
                        // transition is running, which means this is a swipe to dismiss. Values of
                        // 0f and 1f need to be ignored in the legacy shade expansion. These can
+1 −1
Original line number Diff line number Diff line
@@ -633,7 +633,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest
            // GIVEN a prior transition has run to DREAMING
            keyguardRepository.setDreamingWithOverlay(true)
            runTransitionAndSetWakefulness(KeyguardState.LOCKSCREEN, KeyguardState.DREAMING)
            runCurrent()
            advanceTimeBy(60L)

            // WHEN the device wakes up without a keyguard
            keyguardRepository.setKeyguardShowing(false)