diff options
-rw-r--r-- | packages/SystemUI/animation/src/com/android/systemui/animation/DialogTransitionAnimator.kt | 36 | ||||
-rw-r--r-- | packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt | 9 |
2 files changed, 24 insertions, 21 deletions
diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/DialogTransitionAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/DialogTransitionAnimator.kt index c88c4ebb1a8d..6a620b3b9c34 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/DialogTransitionAnimator.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/DialogTransitionAnimator.kt @@ -35,6 +35,7 @@ import android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALW import com.android.app.animation.Interpolators import com.android.internal.jank.Cuj.CujType import com.android.internal.jank.InteractionJankMonitor +import com.android.systemui.Flags import com.android.systemui.util.maybeForceFullscreen import com.android.systemui.util.registerAnimationOnBackInvoked import java.util.concurrent.Executor @@ -932,26 +933,29 @@ private class AnimatedDialog( } override fun onTransitionAnimationEnd(isExpandingFullyAbove: Boolean) { - // onLaunchAnimationEnd is called by an Animator at the end of the animation, - // on a Choreographer animation tick. The following calls will move the animated - // content from the dialog overlay back to its original position, and this - // change must be reflected in the next frame given that we then sync the next - // frame of both the content and dialog ViewRoots. However, in case that content - // is rendered by Compose, whose compositions are also scheduled on a - // Choreographer frame, any state change made *right now* won't be reflected in - // the next frame given that a Choreographer frame can't schedule another and - // have it happen in the same frame. So we post the forwarded calls to - // [Controller.onLaunchAnimationEnd], leaving this Choreographer frame, ensuring - // that the move of the content back to its original window will be reflected in - // the next frame right after [onLaunchAnimationEnd] is called. - // - // TODO(b/330672236): Move this to TransitionAnimator. - dialog.context.mainExecutor.execute { + val onEnd = { startController.onTransitionAnimationEnd(isExpandingFullyAbove) endController.onTransitionAnimationEnd(isExpandingFullyAbove) - onLaunchAnimationEnd() } + if (Flags.sceneContainer()) { + onEnd() + } else { + // onLaunchAnimationEnd is called by an Animator at the end of the + // animation, on a Choreographer animation tick. The following calls will + // move the animated content from the dialog overlay back to its original + // position, and this change must be reflected in the next frame given that + // we then sync the next frame of both the content and dialog ViewRoots. + // However, in case that content is rendered by Compose, whose compositions + // are also scheduled on a Choreographer frame, any state change made *right + // now* won't be reflected in the next frame given that a Choreographer + // frame can't schedule another and have it happen in the same frame. So we + // post the forwarded calls to [Controller.onLaunchAnimationEnd], leaving + // this Choreographer frame, ensuring that the move of the content back to + // its original window will be reflected in the next frame right after + // [onLaunchAnimationEnd] is called. + dialog.context.mainExecutor.execute { onEnd() } + } } override fun onTransitionAnimationProgress( diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt index a4a96d19e8bb..8886b9e5e275 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt @@ -39,6 +39,7 @@ import com.android.app.animation.Interpolators.LINEAR import com.android.internal.annotations.VisibleForTesting import com.android.internal.dynamicanimation.animation.SpringAnimation import com.android.internal.dynamicanimation.animation.SpringForce +import com.android.systemui.Flags import com.android.systemui.Flags.moveTransitionAnimationLayer import com.android.systemui.shared.Flags.returnAnimationFrameworkLibrary import com.android.systemui.shared.Flags.returnAnimationFrameworkLongLived @@ -1014,11 +1015,7 @@ class TransitionAnimator( openingWindowSyncViewOverlay?.remove(windowBackgroundLayer) } } - // TODO(b/330672236): Post this to the main thread for launches as well, so that they do not - // flicker with Flexiglass enabled. - if (controller.isLaunching) { - onEnd() - } else { + if (Flags.sceneContainer() || !controller.isLaunching) { // onAnimationEnd is called at the end of the animation, on a Choreographer animation // tick. During dialog launches, the following calls will move the animated content from // the dialog overlay back to its original position, and this change must be reflected @@ -1032,6 +1029,8 @@ class TransitionAnimator( // Choreographer frame, ensuring that any state change applied by // onTransitionAnimationEnd() will be reflected in the same frame. mainExecutor.execute { onEnd() } + } else { + onEnd() } } |