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

Commit 51751f93 authored by Matt Pietal's avatar Matt Pietal
Browse files

Revert "Revert "NSSL Migration - Animate top padding on shade pu..."

Revert submission 25238254-revert-25203598-JSTZLIMFAD

Reason for revert: Bad test has been fixed

Reverted changes: /q/submissionid:25238254-revert-25203598-JSTZLIMFAD

Change-Id: Icfa87ab72365f4bdd2900ce71d00596f7a083ae1
parent 6366621d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -20,4 +20,7 @@ package com.android.systemui.common.shared.model
data class SharedNotificationContainerPosition(
    val top: Float = 0f,
    val bottom: Float = 0f,

    /** Whether any modifications to top/bottom are smoothly animated */
    val animate: Boolean = false,
)
+2 −4
Original line number Diff line number Diff line
@@ -59,10 +59,8 @@ object SharedNotificationContainerBinder {

                launch {
                    viewModel.position.collect {
                        controller.updateTopPadding(
                            it.top,
                            controller.isAddOrRemoveAnimationPending()
                        )
                        val animate = it.animate || controller.isAddOrRemoveAnimationPending()
                        controller.updateTopPadding(it.top, animate)
                    }
                }

+10 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
import com.android.systemui.statusbar.notification.stack.NotificationStackSizeCalculator
import com.android.systemui.statusbar.notification.stack.domain.interactor.SharedNotificationContainerInteractor
import com.android.systemui.util.kotlin.sample
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
@@ -118,8 +119,15 @@ constructor(
                    }
                }
            } else {
                interactor.topPosition.map { top ->
                    keyguardInteractor.sharedNotificationContainerPosition.value.copy(top = top)
                interactor.topPosition.sample(shadeInteractor.qsExpansion, ::Pair).map {
                    (top, qsExpansion) ->
                    // When QS expansion > 0, it should directly set the top padding so do not
                    // animate it
                    val animate = qsExpansion == 0f
                    keyguardInteractor.sharedNotificationContainerPosition.value.copy(
                        top = top,
                        animate = animate
                    )
                }
            }
        }
+31 −1
Original line number Diff line number Diff line
@@ -314,7 +314,26 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() {
            sharedNotificationContainerInteractor.setTopPosition(10f)

            assertThat(position)
                .isEqualTo(SharedNotificationContainerPosition(top = 10f, bottom = 0f))
                .isEqualTo(
                    SharedNotificationContainerPosition(top = 10f, bottom = 0f, animate = true)
                )
        }

    @Test
    fun positionOnQS() =
        testScope.runTest {
            val position by collectLastValue(underTest.position)

            // Start on lockscreen with shade expanded
            showLockscreenWithQSExpanded()

            // When not in split shade
            sharedNotificationContainerInteractor.setTopPosition(10f)

            assertThat(position)
                .isEqualTo(
                    SharedNotificationContainerPosition(top = 10f, bottom = 0f, animate = false)
                )
        }

    @Test
@@ -390,6 +409,17 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() {
        )
    }

    private suspend fun TestScope.showLockscreenWithQSExpanded() {
        shadeRepository.setLockscreenShadeExpansion(0f)
        shadeRepository.setQsExpansion(1f)
        keyguardRepository.setStatusBarState(StatusBarState.SHADE_LOCKED)
        keyguardTransitionRepository.sendTransitionSteps(
            from = KeyguardState.AOD,
            to = KeyguardState.LOCKSCREEN,
            this,
        )
    }

    @SysUISingleton
    @Component(
        modules =