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

Commit e60af710 authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "NSSL - Only apply y translation when on keyguard" into main

parents 4881667c 59fb1350
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -240,13 +240,13 @@ constructor(
     */
    val translationY: Flow<Float> =
        combine(
            isOnLockscreen,
            isOnLockscreenWithoutShade,
            merge(
                keyguardInteractor.keyguardTranslationY,
                occludedToLockscreenTransitionViewModel.lockscreenTranslationY,
            )
        ) { isOnLockscreen, translationY ->
            if (isOnLockscreen) {
        ) { isOnLockscreenWithoutShade, translationY ->
            if (isOnLockscreenWithoutShade) {
                translationY
            } else {
                0f
+40 −0
Original line number Diff line number Diff line
@@ -483,6 +483,46 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() {
            assertThat(maxNotifications).isEqualTo(-1)
        }

    @Test
    fun translationYUpdatesOnKeyguard() =
        testScope.runTest {
            val translationY by collectLastValue(underTest.translationY)

            configurationRepository.setDimensionPixelSize(
                R.dimen.keyguard_translate_distance_on_swipe_up,
                -100
            )
            configurationRepository.onAnyConfigurationChange()

            // legacy expansion means the user is swiping up, usually for the bouncer
            shadeRepository.setLegacyShadeExpansion(0.5f)

            showLockscreen()

            // The translation values are negative
            assertThat(translationY).isLessThan(0f)
        }

    @Test
    fun translationYDoesNotUpdateWhenShadeIsExpanded() =
        testScope.runTest {
            val translationY by collectLastValue(underTest.translationY)

            configurationRepository.setDimensionPixelSize(
                R.dimen.keyguard_translate_distance_on_swipe_up,
                -100
            )
            configurationRepository.onAnyConfigurationChange()

            // legacy expansion means the user is swiping up, usually for the bouncer but also for
            // shade collapsing
            shadeRepository.setLegacyShadeExpansion(0.5f)

            showLockscreenWithShadeExpanded()

            assertThat(translationY).isEqualTo(0f)
        }

    @Test
    fun updateBounds_fromKeyguardRoot() =
        testScope.runTest {