Merge "Expose STLState.startTransition(Immediately)" into main
diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutState.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutState.kt
index dbff8a4..2e8fc14 100644
--- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutState.kt
+++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutState.kt
@@ -176,6 +176,35 @@
animationScope: CoroutineScope,
transitionKey: TransitionKey? = null,
)
+
+ /**
+ * Instantly start a [transition], running it in [animationScope].
+ *
+ * This call returns immediately and [transition] will be the [currentTransition] of this
+ * [MutableSceneTransitionLayoutState].
+ *
+ * @see startTransition
+ */
+ fun startTransitionImmediately(
+ animationScope: CoroutineScope,
+ transition: TransitionState.Transition,
+ chain: Boolean = true,
+ ): Job
+
+ /**
+ * Start a new [transition].
+ *
+ * If [chain] is `true`, then the transitions will simply be added to [currentTransitions] and
+ * will run in parallel to the current transitions. If [chain] is `false`, then the list of
+ * [currentTransitions] will be cleared and [transition] will be the only running transition.
+ *
+ * If any transition is currently ongoing, it will be interrupted and forced to animate to its
+ * current state by calling [TransitionState.Transition.freezeAndAnimateToCurrentState].
+ *
+ * This method returns when [transition] is done running, i.e. when the call to
+ * [run][TransitionState.Transition.run] returns.
+ */
+ suspend fun startTransition(transition: TransitionState.Transition, chain: Boolean = true)
}
/**
@@ -313,18 +342,10 @@
)
}
- /**
- * Instantly start a [transition], running it in [animationScope].
- *
- * This call returns immediately and [transition] will be the [currentTransition] of this
- * [MutableSceneTransitionLayoutState].
- *
- * @see startTransition
- */
- internal fun startTransitionImmediately(
+ override fun startTransitionImmediately(
animationScope: CoroutineScope,
transition: TransitionState.Transition,
- chain: Boolean = true,
+ chain: Boolean,
): Job {
// Note that we start with UNDISPATCHED so that startTransition() is called directly and
// transition becomes the current [transitionState] right after this call.
@@ -333,23 +354,7 @@
}
}
- /**
- * Start a new [transition].
- *
- * If [chain] is `true`, then the transitions will simply be added to [currentTransitions] and
- * will run in parallel to the current transitions. If [chain] is `false`, then the list of
- * [currentTransitions] will be cleared and [transition] will be the only running transition.
- *
- * If any transition is currently ongoing, it will be interrupted and forced to animate to its
- * current state.
- *
- * This method returns when [transition] is done running, i.e. when the call to
- * [run][TransitionState.Transition.run] returns.
- */
- internal suspend fun startTransition(
- transition: TransitionState.Transition,
- chain: Boolean = true,
- ) {
+ override suspend fun startTransition(transition: TransitionState.Transition, chain: Boolean) {
checkThread()
try {
diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/state/TransitionState.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/state/TransitionState.kt
index 364c203..d6751ae 100644
--- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/state/TransitionState.kt
+++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/state/TransitionState.kt
@@ -300,7 +300,7 @@
}
/** Run this transition and return once it is finished. */
- internal abstract suspend fun run()
+ abstract suspend fun run()
/**
* Freeze this transition state so that neither [currentScene] nor [currentOverlays] will
@@ -311,7 +311,7 @@
*
* This is called when this transition is interrupted (replaced) by another transition.
*/
- internal abstract fun freezeAndAnimateToCurrentState()
+ abstract fun freezeAndAnimateToCurrentState()
internal fun updateOverscrollSpecs(
fromSpec: OverscrollSpecImpl?,