Loading packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerContent.kt +1 −7 Original line number Diff line number Diff line Loading @@ -522,13 +522,7 @@ private fun FoldAware( val currentSceneKey = if (isSplitAroundTheFold) SceneKeys.SplitSceneKey else SceneKeys.ContiguousSceneKey val state = remember { MutableSceneTransitionLayoutState( currentSceneKey, SceneTransitions, enableInterruptions = false, ) } val state = remember { MutableSceneTransitionLayoutState(currentSceneKey, SceneTransitions) } // Update state whenever currentSceneKey has changed. LaunchedEffect(state, currentSceneKey) { Loading packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutState.kt +0 −15 Original line number Diff line number Diff line Loading @@ -234,7 +234,6 @@ fun MutableSceneTransitionLayoutState( canHideOverlay: (OverlayKey) -> Boolean = { true }, canReplaceOverlay: (from: OverlayKey, to: OverlayKey) -> Boolean = { _, _ -> true }, stateLinks: List<StateLink> = emptyList(), enableInterruptions: Boolean = DEFAULT_INTERRUPTIONS_ENABLED, ): MutableSceneTransitionLayoutState { return MutableSceneTransitionLayoutStateImpl( initialScene, Loading @@ -245,7 +244,6 @@ fun MutableSceneTransitionLayoutState( canHideOverlay, canReplaceOverlay, stateLinks, enableInterruptions, ) } Loading @@ -261,9 +259,6 @@ internal class MutableSceneTransitionLayoutStateImpl( true }, private val stateLinks: List<StateLink> = emptyList(), // TODO(b/290930950): Remove this flag. internal val enableInterruptions: Boolean = DEFAULT_INTERRUPTIONS_ENABLED, ) : MutableSceneTransitionLayoutState { private val creationThread: Thread = Thread.currentThread() Loading Loading @@ -406,13 +401,6 @@ internal class MutableSceneTransitionLayoutStateImpl( transition.updateOverscrollSpecs(fromSpec = null, toSpec = null) } if (!enableInterruptions) { // Set the current transition. check(transitionStates.size == 1) transitionStates = listOf(transition) return } when (val currentState = transitionStates.last()) { is TransitionState.Idle -> { // Replace [Idle] by [transition]. Loading Loading @@ -755,9 +743,6 @@ internal class MutableSceneTransitionLayoutStateImpl( private const val TAG = "SceneTransitionLayoutState" /** Whether support for interruptions in enabled by default. */ internal const val DEFAULT_INTERRUPTIONS_ENABLED = true /** * The max number of concurrent transitions. If the number of transitions goes past this number, * this probably means that there is a leak and we will Log.wtf before clearing the list of Loading packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/state/TransitionState.kt +0 −4 Original line number Diff line number Diff line Loading @@ -337,10 +337,6 @@ sealed interface TransitionState { } internal open fun interruptionProgress(layoutImpl: SceneTransitionLayoutImpl): Float { if (!layoutImpl.state.enableInterruptions) { return 0f } if (replacedTransition != null) { return replacedTransition.interruptionProgress(layoutImpl) } Loading packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/ElementTest.kt +6 −5 Original line number Diff line number Diff line Loading @@ -213,10 +213,6 @@ class ElementTest { from(SceneA, to = SceneB) { spec = tween } from(SceneB, to = SceneC) { spec = tween } }, // Disable interruptions so that the current transition is directly removed // when starting a new one. enableInterruptions = false, ) } Loading @@ -243,7 +239,12 @@ class ElementTest { onElement(TestElements.Bar).assertExists() // Start transition from SceneB to SceneC rule.runOnUiThread { state.setTargetScene(SceneC, coroutineScope) } rule.runOnUiThread { // We snap to scene B so that the transition A => B is removed from the list of // transitions. state.snapToScene(SceneB) state.setTargetScene(SceneC, coroutineScope) } } at(3 * frameDuration) { onElement(TestElements.Bar).assertIsNotDisplayed() } Loading packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/SceneTransitionLayoutTest.kt +6 −9 Original line number Diff line number Diff line Loading @@ -85,15 +85,9 @@ class SceneTransitionLayoutTest { /** The content under test. */ @Composable private fun TestContent(enableInterruptions: Boolean = true) { private fun TestContent() { coroutineScope = rememberCoroutineScope() layoutState = remember { MutableSceneTransitionLayoutState( SceneA, EmptyTestTransitions, enableInterruptions = enableInterruptions, ) } layoutState = remember { MutableSceneTransitionLayoutState(SceneA, EmptyTestTransitions) } SceneTransitionLayout(state = layoutState, modifier = Modifier.size(LayoutSize)) { scene(SceneA, userActions = mapOf(Back to SceneB)) { Loading Loading @@ -205,7 +199,7 @@ class SceneTransitionLayoutTest { @Test fun testSharedElement() { rule.setContent { TestContent(enableInterruptions = false) } rule.setContent { TestContent() } // In scene A, the shared element SharedFoo() is at the top end of the layout and has a size // of 50.dp. Loading Loading @@ -253,6 +247,9 @@ class SceneTransitionLayoutTest { .isWithin(DpOffsetSubject.DefaultTolerance) .of(DpOffset(25.dp, 25.dp)) // Finish the transition. rule.mainClock.advanceTimeBy(TestTransitionDuration / 2) // Animate to scene C, let the animation start then go to the middle of the transition. currentScene = SceneC rule.mainClock.advanceTimeByFrame() Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerContent.kt +1 −7 Original line number Diff line number Diff line Loading @@ -522,13 +522,7 @@ private fun FoldAware( val currentSceneKey = if (isSplitAroundTheFold) SceneKeys.SplitSceneKey else SceneKeys.ContiguousSceneKey val state = remember { MutableSceneTransitionLayoutState( currentSceneKey, SceneTransitions, enableInterruptions = false, ) } val state = remember { MutableSceneTransitionLayoutState(currentSceneKey, SceneTransitions) } // Update state whenever currentSceneKey has changed. LaunchedEffect(state, currentSceneKey) { Loading
packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutState.kt +0 −15 Original line number Diff line number Diff line Loading @@ -234,7 +234,6 @@ fun MutableSceneTransitionLayoutState( canHideOverlay: (OverlayKey) -> Boolean = { true }, canReplaceOverlay: (from: OverlayKey, to: OverlayKey) -> Boolean = { _, _ -> true }, stateLinks: List<StateLink> = emptyList(), enableInterruptions: Boolean = DEFAULT_INTERRUPTIONS_ENABLED, ): MutableSceneTransitionLayoutState { return MutableSceneTransitionLayoutStateImpl( initialScene, Loading @@ -245,7 +244,6 @@ fun MutableSceneTransitionLayoutState( canHideOverlay, canReplaceOverlay, stateLinks, enableInterruptions, ) } Loading @@ -261,9 +259,6 @@ internal class MutableSceneTransitionLayoutStateImpl( true }, private val stateLinks: List<StateLink> = emptyList(), // TODO(b/290930950): Remove this flag. internal val enableInterruptions: Boolean = DEFAULT_INTERRUPTIONS_ENABLED, ) : MutableSceneTransitionLayoutState { private val creationThread: Thread = Thread.currentThread() Loading Loading @@ -406,13 +401,6 @@ internal class MutableSceneTransitionLayoutStateImpl( transition.updateOverscrollSpecs(fromSpec = null, toSpec = null) } if (!enableInterruptions) { // Set the current transition. check(transitionStates.size == 1) transitionStates = listOf(transition) return } when (val currentState = transitionStates.last()) { is TransitionState.Idle -> { // Replace [Idle] by [transition]. Loading Loading @@ -755,9 +743,6 @@ internal class MutableSceneTransitionLayoutStateImpl( private const val TAG = "SceneTransitionLayoutState" /** Whether support for interruptions in enabled by default. */ internal const val DEFAULT_INTERRUPTIONS_ENABLED = true /** * The max number of concurrent transitions. If the number of transitions goes past this number, * this probably means that there is a leak and we will Log.wtf before clearing the list of Loading
packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/state/TransitionState.kt +0 −4 Original line number Diff line number Diff line Loading @@ -337,10 +337,6 @@ sealed interface TransitionState { } internal open fun interruptionProgress(layoutImpl: SceneTransitionLayoutImpl): Float { if (!layoutImpl.state.enableInterruptions) { return 0f } if (replacedTransition != null) { return replacedTransition.interruptionProgress(layoutImpl) } Loading
packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/ElementTest.kt +6 −5 Original line number Diff line number Diff line Loading @@ -213,10 +213,6 @@ class ElementTest { from(SceneA, to = SceneB) { spec = tween } from(SceneB, to = SceneC) { spec = tween } }, // Disable interruptions so that the current transition is directly removed // when starting a new one. enableInterruptions = false, ) } Loading @@ -243,7 +239,12 @@ class ElementTest { onElement(TestElements.Bar).assertExists() // Start transition from SceneB to SceneC rule.runOnUiThread { state.setTargetScene(SceneC, coroutineScope) } rule.runOnUiThread { // We snap to scene B so that the transition A => B is removed from the list of // transitions. state.snapToScene(SceneB) state.setTargetScene(SceneC, coroutineScope) } } at(3 * frameDuration) { onElement(TestElements.Bar).assertIsNotDisplayed() } Loading
packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/SceneTransitionLayoutTest.kt +6 −9 Original line number Diff line number Diff line Loading @@ -85,15 +85,9 @@ class SceneTransitionLayoutTest { /** The content under test. */ @Composable private fun TestContent(enableInterruptions: Boolean = true) { private fun TestContent() { coroutineScope = rememberCoroutineScope() layoutState = remember { MutableSceneTransitionLayoutState( SceneA, EmptyTestTransitions, enableInterruptions = enableInterruptions, ) } layoutState = remember { MutableSceneTransitionLayoutState(SceneA, EmptyTestTransitions) } SceneTransitionLayout(state = layoutState, modifier = Modifier.size(LayoutSize)) { scene(SceneA, userActions = mapOf(Back to SceneB)) { Loading Loading @@ -205,7 +199,7 @@ class SceneTransitionLayoutTest { @Test fun testSharedElement() { rule.setContent { TestContent(enableInterruptions = false) } rule.setContent { TestContent() } // In scene A, the shared element SharedFoo() is at the top end of the layout and has a size // of 50.dp. Loading Loading @@ -253,6 +247,9 @@ class SceneTransitionLayoutTest { .isWithin(DpOffsetSubject.DefaultTolerance) .of(DpOffset(25.dp, 25.dp)) // Finish the transition. rule.mainClock.advanceTimeBy(TestTransitionDuration / 2) // Animate to scene C, let the animation start then go to the middle of the transition. currentScene = SceneC rule.mainClock.advanceTimeByFrame() Loading