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

Commit 59fb1350 authored by Matt Pietal's avatar Matt Pietal
Browse files

NSSL - Only apply y translation when on keyguard

... and not when the shade is expanded at all. This ensures the
correct collpase animation runs.

Fixes: 319499695
Test: atest SharedNotificationContainerViewModelTest
Flag: ACONFIG com.android.systemui.keyguard_shade_migration_nssl
DEVELOPMENT

Change-Id: I4eee27b6309c9104f145b133b92a3d20f8d254b6
parent 4198a8df
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -240,13 +240,13 @@ constructor(
     */
     */
    val translationY: Flow<Float> =
    val translationY: Flow<Float> =
        combine(
        combine(
            isOnLockscreen,
            isOnLockscreenWithoutShade,
            merge(
            merge(
                keyguardInteractor.keyguardTranslationY,
                keyguardInteractor.keyguardTranslationY,
                occludedToLockscreenTransitionViewModel.lockscreenTranslationY,
                occludedToLockscreenTransitionViewModel.lockscreenTranslationY,
            )
            )
        ) { isOnLockscreen, translationY ->
        ) { isOnLockscreenWithoutShade, translationY ->
            if (isOnLockscreen) {
            if (isOnLockscreenWithoutShade) {
                translationY
                translationY
            } else {
            } else {
                0f
                0f
+40 −0
Original line number Original line Diff line number Diff line
@@ -407,6 +407,46 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() {
            assertThat(maxNotifications).isEqualTo(-1)
            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
    @Test
    fun updateBounds_fromKeyguardRoot() =
    fun updateBounds_fromKeyguardRoot() =
        testScope.runTest {
        testScope.runTest {