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

Commit 506164fd authored by Matt Pietal's avatar Matt Pietal
Browse files

Keyguard translation - Emit value on start

Make sure that translationY emits a value on start. The combine flow
needs all flows to have started in order to work.

Fixes: 315495314
Test: atest KeyguardRootViewModelTest
Flag: ACONFIG com.android.systemui.keyguard_shade_migration_nssl
DEVELOPMENT

Change-Id: Icb9c42b5187718b1f776fb3f24a1ec1ed018344b
parent 2009d2ce
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -180,7 +180,9 @@ constructor(
                    goneToAodTransitionViewModel
                        .enterFromTopTranslationY(enterFromTopAmount)
                        .onStart { emit(0f) },
                    occludedToLockscreenTransitionViewModel.lockscreenTranslationY,
                    occludedToLockscreenTransitionViewModel.lockscreenTranslationY.onStart {
                        emit(0f)
                    },
                ) {
                    keyguardTransitionY,
                    burnInTranslationY,
@@ -193,6 +195,7 @@ constructor(
                        occludedToLockscreenTransitionTranslationY
                }
            }
            .distinctUntilChanged()

    val translationX: Flow<Float> = burnIn().map { it.translationX.toFloat() }

+7 −0
Original line number Diff line number Diff line
@@ -183,6 +183,13 @@ class KeyguardRootViewModelTest : SysuiTestCase() {
            assertThat(alpha).isEqualTo(0f)
        }

    @Test
    fun translationYInitialValueIsZero() =
        testScope.runTest {
            val translationY by collectLastValue(underTest.translationY)
            assertThat(translationY).isEqualTo(0)
        }

    @Test
    fun translationAndScaleFromBurnInNotDozing() =
        testScope.runTest {