Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModelTest.kt +39 −13 Original line number Diff line number Diff line Loading @@ -23,20 +23,26 @@ import com.android.systemui.biometrics.data.repository.FakeFingerprintPropertyRe import com.android.systemui.biometrics.data.repository.fingerprintPropertyRepository import com.android.systemui.biometrics.shared.model.FingerprintSensorType import com.android.systemui.biometrics.shared.model.SensorStrength import com.android.systemui.coroutines.collectValues import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository import com.android.systemui.keyguard.shared.model.KeyguardState.DREAMING import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN import com.android.systemui.keyguard.shared.model.KeyguardState.UNDEFINED import com.android.systemui.keyguard.shared.model.TransitionState import com.android.systemui.keyguard.shared.model.TransitionState.RUNNING import com.android.systemui.keyguard.shared.model.TransitionState.STARTED import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.collectValues import com.android.systemui.kosmos.runTest import com.android.systemui.kosmos.testScope import com.android.systemui.scene.data.repository.Transition import com.android.systemui.scene.data.repository.setSceneTransition import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.runTest import kotlinx.coroutines.flow.flowOf import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading @@ -45,7 +51,6 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope private lateinit var keyguardTransitionRepository: FakeKeyguardTransitionRepository private lateinit var fingerprintPropertyRepository: FakeFingerprintPropertyRepository private lateinit var underTest: DreamingToLockscreenTransitionViewModel Loading @@ -59,9 +64,10 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { @Test fun shortcutsAlpha_bothShortcutsReceiveLastValue() = testScope.runTest { kosmos.runTest { val valuesLeft by collectValues(underTest.shortcutsAlpha) val valuesRight by collectValues(underTest.shortcutsAlpha) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -81,9 +87,10 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { @Test fun dreamOverlayTranslationY() = testScope.runTest { kosmos.runTest { val pixels = 100 val values by collectValues(underTest.dreamOverlayTranslationY(pixels)) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -104,8 +111,9 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { @Test fun dreamOverlayFadeOut() = testScope.runTest { kosmos.runTest { val values by collectValues(underTest.dreamOverlayAlpha) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -126,8 +134,9 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { @Test fun lockscreenFadeIn() = testScope.runTest { kosmos.runTest { val values by collectValues(underTest.lockscreenAlpha) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -147,8 +156,9 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { @Test fun deviceEntryParentViewFadeIn() = testScope.runTest { kosmos.runTest { val values by collectValues(underTest.deviceEntryParentViewAlpha) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -168,7 +178,7 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { @Test fun deviceEntryBackgroundViewAppear() = testScope.runTest { kosmos.runTest { fingerprintPropertyRepository.setProperties( sensorId = 0, strength = SensorStrength.STRONG, Loading @@ -176,6 +186,7 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { sensorLocations = emptyMap(), ) val values by collectValues(underTest.deviceEntryBackgroundViewAlpha) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -191,11 +202,13 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { values.forEach { assertThat(it).isEqualTo(1f) } } @Test fun lockscreenTranslationY() = testScope.runTest { kosmos.runTest { val pixels = 100 val values by collectValues(underTest.lockscreenTranslationY(pixels)) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -212,13 +225,26 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { values.forEach { assertThat(it).isIn(Range.closed(-100f, 0f)) } } private fun Kosmos.startDreamToLockscreenSceneTransition() { if (SceneContainerFlag.isEnabled) { setSceneTransition( Transition(from = Scenes.Dream, to = Scenes.Lockscreen, progress = flowOf(0f)) ) } } private fun step(value: Float, state: TransitionState = RUNNING): TransitionStep { return TransitionStep( from = DREAMING, from = if (SceneContainerFlag.isEnabled) { UNDEFINED } else { DREAMING }, to = LOCKSCREEN, value = value, transitionState = state, ownerName = "DreamingToLockscreenTransitionViewModelTest" ownerName = "DreamingToLockscreenTransitionViewModelTest", ) } } packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToDreamingTransitionViewModelTest.kt +38 −1 Original line number Diff line number Diff line Loading @@ -34,11 +34,16 @@ import com.android.systemui.kosmos.collectValues import com.android.systemui.kosmos.runTest import com.android.systemui.kosmos.testScope import com.android.systemui.kosmos.useUnconfinedTestDispatcher import com.android.systemui.scene.data.repository.Transition import com.android.systemui.scene.data.repository.setSceneTransition import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.shadeTestUtil import com.android.systemui.statusbar.phone.ScrimState import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.flow.flowOf import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -77,6 +82,8 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) fun lockscreenFadeOut() = kosmos.runTest { val values by collectValues(underTest.lockscreenAlpha) startLockscreenToDreamSceneTransition() fakeKeyguardTransitionRepository.sendTransitionSteps( steps = listOf( Loading @@ -101,6 +108,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) kosmos.runTest { val values by collectValues(underTest.lockscreenAlpha) shadeExpanded(true) startShadeToDreamSceneTransition() fakeKeyguardTransitionRepository.sendTransitionSteps( steps = Loading @@ -123,6 +131,8 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) fun shortcutsFadeOut() = kosmos.runTest { val values by collectValues(underTest.shortcutsAlpha) startLockscreenToDreamSceneTransition() fakeKeyguardTransitionRepository.sendTransitionSteps( steps = listOf( Loading @@ -147,6 +157,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) kosmos.runTest { val values by collectValues(underTest.shortcutsAlpha) shadeExpanded(true) startShadeToDreamSceneTransition() fakeKeyguardTransitionRepository.sendTransitionSteps( steps = Loading @@ -171,6 +182,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) val pixels = 100 val values by collectValues(underTest.lockscreenTranslationY(pixels)) startLockscreenToDreamSceneTransition() fakeKeyguardTransitionRepository.sendTransitionSteps( steps = listOf( Loading @@ -195,6 +207,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) kosmos.runTest { val values by collectValues(underTest.deviceEntryParentViewAlpha) shadeExpanded(true) startShadeToDreamSceneTransition() fakeKeyguardTransitionRepository.sendTransitionSteps( steps = Loading @@ -218,6 +231,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) kosmos.runTest { val actual by collectLastValue(underTest.deviceEntryParentViewAlpha) shadeExpanded(false) startLockscreenToDreamSceneTransition() // fade out fakeKeyguardTransitionRepository.sendTransitionStep(step(0f, TransitionState.STARTED)) Loading @@ -231,6 +245,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) assertThat(actual).isEqualTo(0f) fakeKeyguardTransitionRepository.sendTransitionStep(step(1f, TransitionState.FINISHED)) assertThat(actual).isEqualTo(0f) } Loading @@ -239,6 +254,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) kosmos.runTest { val value by collectLastValue(underTest.scrimAlpha) startLockscreenToDreamSceneTransition() for (step in listOf(0f, 0.2f, 0.5f, 0.8f, 1.0f)) { fakeKeyguardTransitionRepository.sendTransitionStep(step(step)) assertThat(value?.behindAlpha) Loading @@ -246,13 +262,34 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) } } private fun Kosmos.startShadeToDreamSceneTransition() { if (SceneContainerFlag.isEnabled) { setSceneTransition( Transition(from = Scenes.Shade, to = Scenes.Dream, progress = flowOf(0f)) ) } } private fun Kosmos.startLockscreenToDreamSceneTransition() { if (SceneContainerFlag.isEnabled) { setSceneTransition( Transition(from = Scenes.Lockscreen, to = Scenes.Dream, progress = flowOf(0f)) ) } } private fun step( value: Float, state: TransitionState = TransitionState.RUNNING, ): TransitionStep { return TransitionStep( from = KeyguardState.LOCKSCREEN, to = KeyguardState.DREAMING, to = if (SceneContainerFlag.isEnabled) { KeyguardState.UNDEFINED } else { KeyguardState.DREAMING }, value = value, transitionState = state, ownerName = "LockscreenToDreamingTransitionViewModelTest", Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModel.kt +7 −4 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardState.DREAMING import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN import com.android.systemui.keyguard.ui.KeyguardTransitionAnimationFlow import com.android.systemui.keyguard.ui.transitions.DeviceEntryIconTransition import com.android.systemui.scene.shared.model.Scenes import javax.inject.Inject import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.flow.Flow Loading @@ -38,10 +39,12 @@ class DreamingToLockscreenTransitionViewModel constructor(animationFlow: KeyguardTransitionAnimationFlow) : DeviceEntryIconTransition { private val transitionAnimation = animationFlow.setup( animationFlow .setup( duration = TO_LOCKSCREEN_DURATION, edge = Edge.create(from = DREAMING, to = LOCKSCREEN), edge = Edge.create(from = Scenes.Dream, to = LOCKSCREEN), ) .setupWithoutSceneContainer(Edge.create(from = DREAMING, to = LOCKSCREEN)) /** Dream overlay y-translation on exit */ fun dreamOverlayTranslationY(translatePx: Int): Flow<Float> { Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToDreamingTransitionViewModel.kt +7 −4 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN import com.android.systemui.keyguard.shared.model.ScrimAlpha import com.android.systemui.keyguard.ui.KeyguardTransitionAnimationFlow import com.android.systemui.keyguard.ui.transitions.DeviceEntryIconTransition import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.phone.ScrimState import javax.inject.Inject import kotlin.time.Duration.Companion.milliseconds Loading @@ -40,10 +41,12 @@ class LockscreenToDreamingTransitionViewModel @Inject constructor(animationFlow: KeyguardTransitionAnimationFlow) : DeviceEntryIconTransition { private val transitionAnimation = animationFlow.setup( animationFlow .setup( duration = TO_DREAMING_DURATION, edge = Edge.create(from = LOCKSCREEN, to = DREAMING), edge = Edge.create(from = LOCKSCREEN, to = Scenes.Dream), ) .setupWithoutSceneContainer(Edge.create(from = LOCKSCREEN, to = DREAMING)) /** Lockscreen views y-translation */ fun lockscreenTranslationY(translatePx: Int): Flow<Float> { Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModelTest.kt +39 −13 Original line number Diff line number Diff line Loading @@ -23,20 +23,26 @@ import com.android.systemui.biometrics.data.repository.FakeFingerprintPropertyRe import com.android.systemui.biometrics.data.repository.fingerprintPropertyRepository import com.android.systemui.biometrics.shared.model.FingerprintSensorType import com.android.systemui.biometrics.shared.model.SensorStrength import com.android.systemui.coroutines.collectValues import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository import com.android.systemui.keyguard.shared.model.KeyguardState.DREAMING import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN import com.android.systemui.keyguard.shared.model.KeyguardState.UNDEFINED import com.android.systemui.keyguard.shared.model.TransitionState import com.android.systemui.keyguard.shared.model.TransitionState.RUNNING import com.android.systemui.keyguard.shared.model.TransitionState.STARTED import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.collectValues import com.android.systemui.kosmos.runTest import com.android.systemui.kosmos.testScope import com.android.systemui.scene.data.repository.Transition import com.android.systemui.scene.data.repository.setSceneTransition import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.runTest import kotlinx.coroutines.flow.flowOf import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading @@ -45,7 +51,6 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope private lateinit var keyguardTransitionRepository: FakeKeyguardTransitionRepository private lateinit var fingerprintPropertyRepository: FakeFingerprintPropertyRepository private lateinit var underTest: DreamingToLockscreenTransitionViewModel Loading @@ -59,9 +64,10 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { @Test fun shortcutsAlpha_bothShortcutsReceiveLastValue() = testScope.runTest { kosmos.runTest { val valuesLeft by collectValues(underTest.shortcutsAlpha) val valuesRight by collectValues(underTest.shortcutsAlpha) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -81,9 +87,10 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { @Test fun dreamOverlayTranslationY() = testScope.runTest { kosmos.runTest { val pixels = 100 val values by collectValues(underTest.dreamOverlayTranslationY(pixels)) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -104,8 +111,9 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { @Test fun dreamOverlayFadeOut() = testScope.runTest { kosmos.runTest { val values by collectValues(underTest.dreamOverlayAlpha) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -126,8 +134,9 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { @Test fun lockscreenFadeIn() = testScope.runTest { kosmos.runTest { val values by collectValues(underTest.lockscreenAlpha) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -147,8 +156,9 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { @Test fun deviceEntryParentViewFadeIn() = testScope.runTest { kosmos.runTest { val values by collectValues(underTest.deviceEntryParentViewAlpha) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -168,7 +178,7 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { @Test fun deviceEntryBackgroundViewAppear() = testScope.runTest { kosmos.runTest { fingerprintPropertyRepository.setProperties( sensorId = 0, strength = SensorStrength.STRONG, Loading @@ -176,6 +186,7 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { sensorLocations = emptyMap(), ) val values by collectValues(underTest.deviceEntryBackgroundViewAlpha) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -191,11 +202,13 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { values.forEach { assertThat(it).isEqualTo(1f) } } @Test fun lockscreenTranslationY() = testScope.runTest { kosmos.runTest { val pixels = 100 val values by collectValues(underTest.lockscreenTranslationY(pixels)) startDreamToLockscreenSceneTransition() keyguardTransitionRepository.sendTransitionSteps( listOf( Loading @@ -212,13 +225,26 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { values.forEach { assertThat(it).isIn(Range.closed(-100f, 0f)) } } private fun Kosmos.startDreamToLockscreenSceneTransition() { if (SceneContainerFlag.isEnabled) { setSceneTransition( Transition(from = Scenes.Dream, to = Scenes.Lockscreen, progress = flowOf(0f)) ) } } private fun step(value: Float, state: TransitionState = RUNNING): TransitionStep { return TransitionStep( from = DREAMING, from = if (SceneContainerFlag.isEnabled) { UNDEFINED } else { DREAMING }, to = LOCKSCREEN, value = value, transitionState = state, ownerName = "DreamingToLockscreenTransitionViewModelTest" ownerName = "DreamingToLockscreenTransitionViewModelTest", ) } }
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToDreamingTransitionViewModelTest.kt +38 −1 Original line number Diff line number Diff line Loading @@ -34,11 +34,16 @@ import com.android.systemui.kosmos.collectValues import com.android.systemui.kosmos.runTest import com.android.systemui.kosmos.testScope import com.android.systemui.kosmos.useUnconfinedTestDispatcher import com.android.systemui.scene.data.repository.Transition import com.android.systemui.scene.data.repository.setSceneTransition import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.shadeTestUtil import com.android.systemui.statusbar.phone.ScrimState import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.flow.flowOf import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -77,6 +82,8 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) fun lockscreenFadeOut() = kosmos.runTest { val values by collectValues(underTest.lockscreenAlpha) startLockscreenToDreamSceneTransition() fakeKeyguardTransitionRepository.sendTransitionSteps( steps = listOf( Loading @@ -101,6 +108,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) kosmos.runTest { val values by collectValues(underTest.lockscreenAlpha) shadeExpanded(true) startShadeToDreamSceneTransition() fakeKeyguardTransitionRepository.sendTransitionSteps( steps = Loading @@ -123,6 +131,8 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) fun shortcutsFadeOut() = kosmos.runTest { val values by collectValues(underTest.shortcutsAlpha) startLockscreenToDreamSceneTransition() fakeKeyguardTransitionRepository.sendTransitionSteps( steps = listOf( Loading @@ -147,6 +157,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) kosmos.runTest { val values by collectValues(underTest.shortcutsAlpha) shadeExpanded(true) startShadeToDreamSceneTransition() fakeKeyguardTransitionRepository.sendTransitionSteps( steps = Loading @@ -171,6 +182,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) val pixels = 100 val values by collectValues(underTest.lockscreenTranslationY(pixels)) startLockscreenToDreamSceneTransition() fakeKeyguardTransitionRepository.sendTransitionSteps( steps = listOf( Loading @@ -195,6 +207,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) kosmos.runTest { val values by collectValues(underTest.deviceEntryParentViewAlpha) shadeExpanded(true) startShadeToDreamSceneTransition() fakeKeyguardTransitionRepository.sendTransitionSteps( steps = Loading @@ -218,6 +231,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) kosmos.runTest { val actual by collectLastValue(underTest.deviceEntryParentViewAlpha) shadeExpanded(false) startLockscreenToDreamSceneTransition() // fade out fakeKeyguardTransitionRepository.sendTransitionStep(step(0f, TransitionState.STARTED)) Loading @@ -231,6 +245,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) assertThat(actual).isEqualTo(0f) fakeKeyguardTransitionRepository.sendTransitionStep(step(1f, TransitionState.FINISHED)) assertThat(actual).isEqualTo(0f) } Loading @@ -239,6 +254,7 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) kosmos.runTest { val value by collectLastValue(underTest.scrimAlpha) startLockscreenToDreamSceneTransition() for (step in listOf(0f, 0.2f, 0.5f, 0.8f, 1.0f)) { fakeKeyguardTransitionRepository.sendTransitionStep(step(step)) assertThat(value?.behindAlpha) Loading @@ -246,13 +262,34 @@ class LockscreenToDreamingTransitionViewModelTest(flags: FlagsParameterization) } } private fun Kosmos.startShadeToDreamSceneTransition() { if (SceneContainerFlag.isEnabled) { setSceneTransition( Transition(from = Scenes.Shade, to = Scenes.Dream, progress = flowOf(0f)) ) } } private fun Kosmos.startLockscreenToDreamSceneTransition() { if (SceneContainerFlag.isEnabled) { setSceneTransition( Transition(from = Scenes.Lockscreen, to = Scenes.Dream, progress = flowOf(0f)) ) } } private fun step( value: Float, state: TransitionState = TransitionState.RUNNING, ): TransitionStep { return TransitionStep( from = KeyguardState.LOCKSCREEN, to = KeyguardState.DREAMING, to = if (SceneContainerFlag.isEnabled) { KeyguardState.UNDEFINED } else { KeyguardState.DREAMING }, value = value, transitionState = state, ownerName = "LockscreenToDreamingTransitionViewModelTest", Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModel.kt +7 −4 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardState.DREAMING import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN import com.android.systemui.keyguard.ui.KeyguardTransitionAnimationFlow import com.android.systemui.keyguard.ui.transitions.DeviceEntryIconTransition import com.android.systemui.scene.shared.model.Scenes import javax.inject.Inject import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.flow.Flow Loading @@ -38,10 +39,12 @@ class DreamingToLockscreenTransitionViewModel constructor(animationFlow: KeyguardTransitionAnimationFlow) : DeviceEntryIconTransition { private val transitionAnimation = animationFlow.setup( animationFlow .setup( duration = TO_LOCKSCREEN_DURATION, edge = Edge.create(from = DREAMING, to = LOCKSCREEN), edge = Edge.create(from = Scenes.Dream, to = LOCKSCREEN), ) .setupWithoutSceneContainer(Edge.create(from = DREAMING, to = LOCKSCREEN)) /** Dream overlay y-translation on exit */ fun dreamOverlayTranslationY(translatePx: Int): Flow<Float> { Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToDreamingTransitionViewModel.kt +7 −4 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN import com.android.systemui.keyguard.shared.model.ScrimAlpha import com.android.systemui.keyguard.ui.KeyguardTransitionAnimationFlow import com.android.systemui.keyguard.ui.transitions.DeviceEntryIconTransition import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.phone.ScrimState import javax.inject.Inject import kotlin.time.Duration.Companion.milliseconds Loading @@ -40,10 +41,12 @@ class LockscreenToDreamingTransitionViewModel @Inject constructor(animationFlow: KeyguardTransitionAnimationFlow) : DeviceEntryIconTransition { private val transitionAnimation = animationFlow.setup( animationFlow .setup( duration = TO_DREAMING_DURATION, edge = Edge.create(from = LOCKSCREEN, to = DREAMING), edge = Edge.create(from = LOCKSCREEN, to = Scenes.Dream), ) .setupWithoutSceneContainer(Edge.create(from = LOCKSCREEN, to = DREAMING)) /** Lockscreen views y-translation */ fun lockscreenTranslationY(translatePx: Int): Flow<Float> { Loading