Clean up STL transitions coroutine management

This CL cleans up the scoping of the coroutines involved in the
transitions of a SceneTransitionLayoutState.

This CL changes the main API to start a transition:
MutableSTLState.startTransition() is now a suspend function which:

  1. Sets the transition as the current STLState.transitionState.
  2. Runs the suspend fun run() method of the transition.
  3. Finishes the transition when the transition is done running.

Doing this makes it easier to correctly scope a transition animation and
removes the need to call finishTransition() when a transition is done.

This CL also renames Transition.finish() to
Transition.freezeAndAnimateToCurrentState().

Bug: 362727477
Test: atest PlatformComposeSceneTransitionLayoutTests
Flag: com.android.systemui.scene_container
Change-Id: I5455dcd75b6cc9d79dcb8afb8dd6ddd6f9bfcdff
22 files changed