Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67306b1e authored by Luca Zuccarini's avatar Luca Zuccarini
Browse files

Always put the opening window above the origin launchable.

Bug: 390422470
Flag: com.android.systemui.move_transition_animation_layer
Test: atest ActivityTransitionAnimatorTest TransitionAnimatorTest
Change-Id: I6954ee1b06267a28d25662af3feb97303bf3cfdc
parent 88834a87
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -2103,3 +2103,10 @@ flag {
        purpose: PURPOSE_BUGFIX
        purpose: PURPOSE_BUGFIX
    }
    }
}
}

flag {
    name: "move_transition_animation_layer"
    namespace: "systemui"
    description: "Enables moving the launching window on top of the origin window in the Animation library."
    bug: "390422470"
}
+23 −2
Original line number Original line Diff line number Diff line
@@ -62,6 +62,7 @@ import com.android.app.animation.Interpolators
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.policy.ScreenDecorationsUtils
import com.android.internal.policy.ScreenDecorationsUtils
import com.android.systemui.Flags.activityTransitionUseLargestWindow
import com.android.systemui.Flags.activityTransitionUseLargestWindow
import com.android.systemui.Flags.moveTransitionAnimationLayer
import com.android.systemui.Flags.translucentOccludingActivityFix
import com.android.systemui.Flags.translucentOccludingActivityFix
import com.android.systemui.animation.TransitionAnimator.Companion.assertLongLivedReturnAnimations
import com.android.systemui.animation.TransitionAnimator.Companion.assertLongLivedReturnAnimations
import com.android.systemui.animation.TransitionAnimator.Companion.assertReturnAnimations
import com.android.systemui.animation.TransitionAnimator.Companion.assertReturnAnimations
@@ -1514,6 +1515,20 @@ constructor(
                            )
                            )
                        }
                        }


                        if (moveTransitionAnimationLayer()) {
                            // Ensure that the launching window is rendered above the view's window,
                            // so it is not obstructed.
                            // TODO(b/397180418): re-use the start transaction once the
                            //  RemoteAnimation wrapper is cleaned up.
                            SurfaceControl.Transaction().use {
                                it.reparent(
                                    window.leash,
                                    controller.transitionContainer.viewRootImpl.surfaceControl,
                                )
                                it.apply()
                            }
                        }

                        if (startTransaction != null) {
                        if (startTransaction != null) {
                            // Calling applyStateToWindow() here avoids skipping a frame when taking
                            // Calling applyStateToWindow() here avoids skipping a frame when taking
                            // over an animation.
                            // over an animation.
@@ -1566,12 +1581,18 @@ constructor(
                } else {
                } else {
                    null
                    null
                }
                }
            val fadeWindowBackgroundLayer =
                if (moveTransitionAnimationLayer()) {
                    false
                } else {
                    !controller.isBelowAnimatingWindow
                }
            animation =
            animation =
                transitionAnimator.startAnimation(
                transitionAnimator.startAnimation(
                    controller,
                    controller,
                    endState,
                    endState,
                    windowBackgroundColor,
                    windowBackgroundColor,
                    fadeWindowBackgroundLayer = !controller.isBelowAnimatingWindow,
                    fadeWindowBackgroundLayer = fadeWindowBackgroundLayer,
                    drawHole = !controller.isBelowAnimatingWindow,
                    drawHole = !controller.isBelowAnimatingWindow,
                    startVelocity = velocityPxPerS,
                    startVelocity = velocityPxPerS,
                    startFrameTime = windowState?.timestamp ?: -1,
                    startFrameTime = windowState?.timestamp ?: -1,
@@ -1685,7 +1706,7 @@ constructor(
            // fade in progressively. Otherwise, it should be fully opaque and will be progressively
            // fade in progressively. Otherwise, it should be fully opaque and will be progressively
            // revealed as the window background color layer above the window fades out.
            // revealed as the window background color layer above the window fades out.
            val alpha =
            val alpha =
                if (controller.isBelowAnimatingWindow) {
                if (moveTransitionAnimationLayer() || controller.isBelowAnimatingWindow) {
                    if (controller.isLaunching) {
                    if (controller.isLaunching) {
                        interpolators.contentAfterFadeInInterpolator.getInterpolation(
                        interpolators.contentAfterFadeInInterpolator.getInterpolation(
                            windowProgress
                            windowProgress
+7 −0
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.app.animation.Interpolators.LINEAR
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.dynamicanimation.animation.SpringAnimation
import com.android.internal.dynamicanimation.animation.SpringAnimation
import com.android.internal.dynamicanimation.animation.SpringForce
import com.android.internal.dynamicanimation.animation.SpringForce
import com.android.systemui.Flags.moveTransitionAnimationLayer
import com.android.systemui.shared.Flags.returnAnimationFrameworkLibrary
import com.android.systemui.shared.Flags.returnAnimationFrameworkLibrary
import com.android.systemui.shared.Flags.returnAnimationFrameworkLongLived
import com.android.systemui.shared.Flags.returnAnimationFrameworkLongLived
import java.util.concurrent.Executor
import java.util.concurrent.Executor
@@ -509,6 +510,8 @@ class TransitionAnimator(
     * punching a hole in the [transition container][Controller.transitionContainer]) iff [drawHole]
     * punching a hole in the [transition container][Controller.transitionContainer]) iff [drawHole]
     * is true.
     * is true.
     *
     *
     * TODO(b/397646693): remove drawHole altogether.
     *
     * If [startVelocity] (expressed in pixels per second) is not null, a multi-spring animation
     * If [startVelocity] (expressed in pixels per second) is not null, a multi-spring animation
     * using it for the initial momentum will be used instead of the default interpolators. In this
     * using it for the initial momentum will be used instead of the default interpolators. In this
     * case, [startFrameTime] (if non-negative) represents the frame time at which the springs
     * case, [startFrameTime] (if non-negative) represents the frame time at which the springs
@@ -1183,6 +1186,10 @@ class TransitionAnimator(
                if (drawHole) {
                if (drawHole) {
                    drawable.setXfermode(SRC_MODE)
                    drawable.setXfermode(SRC_MODE)
                }
                }
            } else if (moveTransitionAnimationLayer() && fadeOutProgress >= 1 && drawHole) {
                // If [drawHole] is true, draw it once the opening content is done fading in.
                drawable.alpha = 0x00
                drawable.setXfermode(SRC_MODE)
            } else {
            } else {
                drawable.alpha = 0xFF
                drawable.alpha = 0xFF
            }
            }
+0 −0

File moved.

+0 −0

File moved.

Loading