Loading packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/SceneContainer.kt +1 −5 Original line number Diff line number Diff line Loading @@ -37,8 +37,6 @@ import androidx.compose.ui.input.pointer.pointerInput import com.android.compose.animation.scene.MutableSceneTransitionLayoutState import com.android.compose.animation.scene.SceneKey import com.android.compose.animation.scene.SceneTransitionLayout import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult import com.android.compose.animation.scene.observableTransitionState import com.android.systemui.ribbon.ui.composable.BottomRightCornerRibbon import com.android.systemui.scene.shared.model.SceneDataSourceDelegator Loading Loading @@ -71,9 +69,7 @@ fun SceneContainer( ) { val coroutineScope = rememberCoroutineScope() val currentSceneKey: SceneKey by viewModel.currentScene.collectAsState() val currentScene = checkNotNull(sceneByKey[currentSceneKey]) val currentDestinations: Map<UserAction, UserActionResult> by currentScene.destinationScenes.collectAsState() val currentDestinations by viewModel.currentDestinationScenes(coroutineScope).collectAsState() val state: MutableSceneTransitionLayoutState = remember { MutableSceneTransitionLayoutState( initialScene = currentSceneKey, Loading packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Scene.kt +4 −1 Original line number Diff line number Diff line Loading @@ -59,7 +59,10 @@ internal class Scene( ): Map<UserAction, UserActionResult> { userActions.forEach { (action, result) -> if (key == result.toScene) { error("Transition to the same scene is not supported. Scene $key, action $action") error( "Transition to the same scene is not supported. Scene $key, action $action," + " result $result" ) } } return userActions Loading packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModelTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ class QuickSettingsSceneViewModelTest : SysuiTestCase() { val destinations by collectLastValue(underTest.destinationScenes) val currentScene by collectLastValue(sceneInteractor.currentScene) val previousScene by collectLastValue(sceneInteractor.previousScene) val previousScene by collectLastValue(sceneInteractor.previousScene()) sceneInteractor.changeScene(Scenes.Lockscreen, "reason") sceneInteractor.changeScene(Scenes.QuickSettings, "reason") assertThat(currentScene).isEqualTo(Scenes.QuickSettings) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,7 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() { sceneInteractor = sceneInteractor, falsingInteractor = kosmos.falsingInteractor, powerInteractor = kosmos.powerInteractor, scenes = kosmos.scenes, ) .apply { setTransitionState(transitionState) } } Loading packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt +16 −1 Original line number Diff line number Diff line Loading @@ -296,7 +296,7 @@ class SceneInteractorTest : SysuiTestCase() { fun previousScene() = testScope.runTest { val currentScene by collectLastValue(underTest.currentScene) val previousScene by collectLastValue(underTest.previousScene) val previousScene by collectLastValue(underTest.previousScene()) assertThat(previousScene).isNull() val firstScene = currentScene Loading @@ -306,4 +306,19 @@ class SceneInteractorTest : SysuiTestCase() { underTest.changeScene(toScene = Scenes.QuickSettings, "reason") assertThat(previousScene).isEqualTo(Scenes.Shade) } @Test fun previousScene_withIgnoredScene() = testScope.runTest { val currentScene by collectLastValue(underTest.currentScene) val previousScene by collectLastValue(underTest.previousScene(ignored = Scenes.Shade)) assertThat(previousScene).isNull() val firstScene = currentScene underTest.changeScene(toScene = Scenes.Shade, "reason") assertThat(previousScene).isEqualTo(firstScene) underTest.changeScene(toScene = Scenes.QuickSettings, "reason") assertThat(previousScene).isNull() } } Loading
packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/SceneContainer.kt +1 −5 Original line number Diff line number Diff line Loading @@ -37,8 +37,6 @@ import androidx.compose.ui.input.pointer.pointerInput import com.android.compose.animation.scene.MutableSceneTransitionLayoutState import com.android.compose.animation.scene.SceneKey import com.android.compose.animation.scene.SceneTransitionLayout import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult import com.android.compose.animation.scene.observableTransitionState import com.android.systemui.ribbon.ui.composable.BottomRightCornerRibbon import com.android.systemui.scene.shared.model.SceneDataSourceDelegator Loading Loading @@ -71,9 +69,7 @@ fun SceneContainer( ) { val coroutineScope = rememberCoroutineScope() val currentSceneKey: SceneKey by viewModel.currentScene.collectAsState() val currentScene = checkNotNull(sceneByKey[currentSceneKey]) val currentDestinations: Map<UserAction, UserActionResult> by currentScene.destinationScenes.collectAsState() val currentDestinations by viewModel.currentDestinationScenes(coroutineScope).collectAsState() val state: MutableSceneTransitionLayoutState = remember { MutableSceneTransitionLayoutState( initialScene = currentSceneKey, Loading
packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Scene.kt +4 −1 Original line number Diff line number Diff line Loading @@ -59,7 +59,10 @@ internal class Scene( ): Map<UserAction, UserActionResult> { userActions.forEach { (action, result) -> if (key == result.toScene) { error("Transition to the same scene is not supported. Scene $key, action $action") error( "Transition to the same scene is not supported. Scene $key, action $action," + " result $result" ) } } return userActions Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModelTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ class QuickSettingsSceneViewModelTest : SysuiTestCase() { val destinations by collectLastValue(underTest.destinationScenes) val currentScene by collectLastValue(sceneInteractor.currentScene) val previousScene by collectLastValue(sceneInteractor.previousScene) val previousScene by collectLastValue(sceneInteractor.previousScene()) sceneInteractor.changeScene(Scenes.Lockscreen, "reason") sceneInteractor.changeScene(Scenes.QuickSettings, "reason") assertThat(currentScene).isEqualTo(Scenes.QuickSettings) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,7 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() { sceneInteractor = sceneInteractor, falsingInteractor = kosmos.falsingInteractor, powerInteractor = kosmos.powerInteractor, scenes = kosmos.scenes, ) .apply { setTransitionState(transitionState) } } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt +16 −1 Original line number Diff line number Diff line Loading @@ -296,7 +296,7 @@ class SceneInteractorTest : SysuiTestCase() { fun previousScene() = testScope.runTest { val currentScene by collectLastValue(underTest.currentScene) val previousScene by collectLastValue(underTest.previousScene) val previousScene by collectLastValue(underTest.previousScene()) assertThat(previousScene).isNull() val firstScene = currentScene Loading @@ -306,4 +306,19 @@ class SceneInteractorTest : SysuiTestCase() { underTest.changeScene(toScene = Scenes.QuickSettings, "reason") assertThat(previousScene).isEqualTo(Scenes.Shade) } @Test fun previousScene_withIgnoredScene() = testScope.runTest { val currentScene by collectLastValue(underTest.currentScene) val previousScene by collectLastValue(underTest.previousScene(ignored = Scenes.Shade)) assertThat(previousScene).isNull() val firstScene = currentScene underTest.changeScene(toScene = Scenes.Shade, "reason") assertThat(previousScene).isEqualTo(firstScene) underTest.changeScene(toScene = Scenes.QuickSettings, "reason") assertThat(previousScene).isNull() } }