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

Commit 59148c4f authored by Presubmit Automerger Backend's avatar Presubmit Automerger Backend
Browse files

[automerge] Reset NSSL translationY after a transision gets cancelled 2p: 3a23e91c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22650441

Change-Id: I4436e1f603399db596bc2ba43f1b8cac70318dc8
parents f2356520 3a23e91c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ constructor(
            duration = TO_LOCKSCREEN_DURATION,
            onStep = { value -> -translatePx + value * translatePx },
            interpolator = EMPHASIZED_DECELERATE,
            onCancel = { 0f },
        )
    }

+15 −0
Original line number Diff line number Diff line
@@ -92,6 +92,21 @@ class OccludedToLockscreenTransitionViewModelTest : SysuiTestCase() {
            job.cancel()
        }

    @Test
    fun lockscreenTranslationYResettedAfterJobCancelled() =
        runTest(UnconfinedTestDispatcher()) {
            val values = mutableListOf<Float>()

            val pixels = 100
            val job =
                underTest.lockscreenTranslationY(pixels).onEach { values.add(it) }.launchIn(this)
            repository.sendTransitionStep(step(0.5f, TransitionState.CANCELED))

            assertThat(values.last()).isEqualTo(0f)

            job.cancel()
        }

    private fun step(
        value: Float,
        state: TransitionState = TransitionState.RUNNING