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

Commit 101dae35 authored by Coco Duan's avatar Coco Duan
Browse files

Disable motion flag on tests for legacy hub transition animation

For tests verifying the legacy lock screen to Hub animation, ensure the
motion flag is disabled. So the flag can be rolled out to staging in
ag/34436278.

Bug: 404535174
Test: atest GlanceableHubToLockscreenTransitionViewModelTest
Test: atest LockscreenToGlanceableHubTransitionViewModelTest
Flag: com.android.systemui.gesture_between_hub_and_lockscreen_motion
Change-Id: Ide771ec41f294e96877a177b121b9b0c53bc20ad
parent 31dd0cf5
Loading
Loading
Loading
Loading
+41 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.platform.test.flag.junit.FlagsParameterization
import android.util.LayoutDirection
import androidx.test.filters.SmallTest
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.systemui.Flags
import com.android.systemui.Flags.FLAG_GLANCEABLE_HUB_V2
import com.android.systemui.SysuiTestCase
import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository
@@ -82,7 +83,8 @@ class GlanceableHubToLockscreenTransitionViewModelTest(flags: FlagsParameterizat
    }

    @Test
    fun lockscreenFadeIn() =
    @DisableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION)
    fun lockscreenFadeIn_motionFlagDisabled() =
        kosmos.runTest {
            communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")

@@ -111,8 +113,41 @@ class GlanceableHubToLockscreenTransitionViewModelTest(flags: FlagsParameterizat
            values.forEach { assertThat(it).isIn(Range.closed(0f, 1f)) }
        }

    @Test
    @EnableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION)
    fun lockscreenFadeIn_motionFlagEnabled() =
        kosmos.runTest {
            communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")

            val values by collectValues(underTest.keyguardAlpha)
            assertThat(values).isEmpty()

            keyguardTransitionRepository.sendTransitionSteps(
                listOf(
                    step(0f, TransitionState.STARTED),
                    step(0.1f),
                    step(0.2f),
                    step(0.3f),
                    // Should start running here...
                    step(0.4f),
                    step(0.5f),
                    step(0.6f),
                    step(0.7f),
                    // ...up to here
                    step(0.8f),
                    step(0.9f),
                    step(1f),
                ),
                testScope,
            )

            assertThat(values).hasSize(4)
            values.forEach { assertThat(it).isIn(Range.closed(0f, 1f)) }
        }

    @Test
    @EnableFlags(FLAG_GLANCEABLE_HUB_V2)
    @DisableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION)
    fun lockscreenFadeIn_fromHubInLandscape() =
        kosmos.runTest {
            kosmos.setCommunalV2ConfigEnabled(true)
@@ -185,7 +220,7 @@ class GlanceableHubToLockscreenTransitionViewModelTest(flags: FlagsParameterizat
        }

    @Test
    @DisableFlags(FLAG_GLANCEABLE_HUB_V2)
    @DisableFlags(FLAG_GLANCEABLE_HUB_V2, Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION)
    fun lockscreenFadeIn_v2FlagDisabledAndFromHubInLandscape() =
        kosmos.runTest {
            whenever(keyguardStateController.isKeyguardScreenRotationAllowed).thenReturn(false)
@@ -222,6 +257,7 @@ class GlanceableHubToLockscreenTransitionViewModelTest(flags: FlagsParameterizat
        }

    @Test
    @DisableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION)
    fun lockscreenTranslationX() =
        kosmos.runTest {
            val config: Configuration = mock()
@@ -254,6 +290,7 @@ class GlanceableHubToLockscreenTransitionViewModelTest(flags: FlagsParameterizat

    @Test
    @EnableFlags(FLAG_GLANCEABLE_HUB_V2)
    @DisableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION)
    fun lockscreenTranslationX_fromHubInLandscape() =
        kosmos.runTest {
            kosmos.setCommunalV2ConfigEnabled(true)
@@ -291,6 +328,7 @@ class GlanceableHubToLockscreenTransitionViewModelTest(flags: FlagsParameterizat
        }

    @Test
    @DisableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION)
    fun lockscreenTranslationX_resetsAfterCancellation() =
        kosmos.runTest {
            val config: Configuration = mock()
@@ -324,6 +362,7 @@ class GlanceableHubToLockscreenTransitionViewModelTest(flags: FlagsParameterizat

    @Test
    @EnableFlags(FLAG_GLANCEABLE_HUB_V2)
    @DisableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION)
    fun lockscreenTranslationX_resetsAfterCancellation_fromHubInLandscape() =
        kosmos.runTest {
            kosmos.setCommunalV2ConfigEnabled(true)
+35 −2
Original line number Diff line number Diff line
@@ -17,9 +17,12 @@
package com.android.systemui.keyguard.ui.viewmodel

import android.content.res.Configuration
import android.platform.test.annotations.DisableFlags
import android.platform.test.annotations.EnableFlags
import android.util.LayoutDirection
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository
import com.android.systemui.flags.DisableSceneContainer
@@ -52,7 +55,8 @@ class LockscreenToGlanceableHubTransitionViewModelTest : SysuiTestCase() {
    val underTest by lazy { kosmos.lockscreenToGlanceableHubTransitionViewModel }

    @Test
    fun lockscreenFadeOut() =
    @DisableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION)
    fun lockscreenFadeOut_motionFlagDisabled() =
        kosmos.runTest {
            val values by collectValues(underTest.keyguardAlpha)
            assertThat(values).isEmpty()
@@ -70,7 +74,6 @@ class LockscreenToGlanceableHubTransitionViewModelTest : SysuiTestCase() {
                    step(0.6f),
                    step(0.7f),
                    step(0.8f),
                    // ...up to here
                    step(1f),
                ),
                testScope,
@@ -81,6 +84,36 @@ class LockscreenToGlanceableHubTransitionViewModelTest : SysuiTestCase() {
        }

    @Test
    @EnableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION)
    fun lockscreenFadeOut_motionFlagEnabled() =
        kosmos.runTest {
            val values by collectValues(underTest.keyguardAlpha)
            assertThat(values).isEmpty()

            keyguardTransitionRepository.sendTransitionSteps(
                listOf(
                    // Should start running here
                    step(0f, TransitionState.STARTED),
                    step(0.1f),
                    step(0.2f),
                    step(0.3f),
                    step(0.4f),
                    step(0.5f),
                    // ...up to here
                    step(0.6f),
                    step(0.7f),
                    step(0.8f),
                    step(1f),
                ),
                testScope,
            )

            assertThat(values).hasSize(6)
            values.forEach { assertThat(it).isIn(Range.closed(0f, 1f)) }
        }

    @Test
    @DisableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION)
    fun lockscreenTranslationX() =
        kosmos.runTest {
            configurationRepository.setDimensionPixelSize(