summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Luca Zuccarini <acul@google.com> 2025-03-21 14:03:49 +0000
committer Luca Zuccarini <acul@google.com> 2025-03-21 14:06:10 +0000
commiteaeae16402d76a843184a2efb4547bccd7235f55 (patch)
treef74ae9bd40c2f4357cb640e72b5b8137c7f9321b
parentf6d3e7a71bb25588ef953c2ee2f7f6b3ab3f99fc (diff)
Reinstate the original fix for Flexi flicker, gated behind Flexi.
Fix: 330672236 Flag: com.android.systemui.scene_container Test: atest DialogTransitionAnimatorTest TransitionAnimatorTest + manual verification Change-Id: I67018403ec90434905c706b4f633da4d6c0cea2e
-rw-r--r--packages/SystemUI/animation/src/com/android/systemui/animation/DialogTransitionAnimator.kt36
-rw-r--r--packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt9
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()
}
}