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

Commit 596a199d authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix z-order when transfering animations

We need to reparent the transfered leash to the the animation
layer, not the original parent

Test: Open Play Movies, observe correct z-order during cold-launch
Test: go/wm-smoke
Test: SurfaceAnimatorTest
Change-Id: Ic5a68c68514bb3560b6877a9a29c506aeccee2bf
parent 7efb442a
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ class AppWindowThumbnail implements Animatable {

    @Override
    public Builder makeAnimationLeash() {
        return mAppToken.makeSurface().setParent(mAppToken.getAppAnimationLayer());
        return mAppToken.makeSurface();
    }

    @Override
@@ -147,6 +147,11 @@ class AppWindowThumbnail implements Animatable {
        return mSurfaceControl;
    }

    @Override
    public SurfaceControl getAnimationLeashParent() {
        return mAppToken.getAppAnimationLayer();
    }

    @Override
    public SurfaceControl getParentSurfaceControl() {
        return mAppToken.getParentSurfaceControl();
+2 −3
Original line number Diff line number Diff line
@@ -1512,9 +1512,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
    }

    @Override
    public SurfaceControl.Builder makeAnimationLeash() {
        return super.makeAnimationLeash()
                .setParent(getAppAnimationLayer());
    public SurfaceControl getAnimationLeashParent() {
        return getAppAnimationLayer();
    }

    boolean applyAnimationLocked(WindowManager.LayoutParams lp, int transit, boolean enter,
+7 −1
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ class SurfaceAnimator {
            return;
        }
        final SurfaceControl surface = mAnimatable.getSurfaceControl();
        final SurfaceControl parent = mAnimatable.getParentSurfaceControl();
        final SurfaceControl parent = mAnimatable.getAnimationLeashParent();
        if (surface == null || parent == null) {
            Slog.w(TAG, "Unable to transfer animation, surface or parent is null");
            cancelAnimation();
@@ -293,6 +293,7 @@ class SurfaceAnimator {
            int height, boolean hidden) {
        if (DEBUG_ANIM) Slog.i(TAG, "Reparenting to leash");
        final SurfaceControl.Builder builder = mAnimatable.makeAnimationLeash()
                .setParent(mAnimatable.getAnimationLeashParent())
                .setName(surface + " - animation-leash")
                .setSize(width, height);
        final SurfaceControl leash = builder.build();
@@ -360,6 +361,11 @@ class SurfaceAnimator {
         */
        SurfaceControl.Builder makeAnimationLeash();

        /**
         * @return The parent that should be used for the animation leash.
         */
        @Nullable SurfaceControl getAnimationLeashParent();

        /**
         * @return The surface of the object to be animated.
         */
+5 −0
Original line number Diff line number Diff line
@@ -1088,6 +1088,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        return makeSurface();
    }

    @Override
    public SurfaceControl getAnimationLeashParent() {
        return getParentSurfaceControl();
    }

    /**
     * @return The layer on which all app animations are happening.
     */
+5 −0
Original line number Diff line number Diff line
@@ -245,6 +245,11 @@ public class SurfaceAnimatorTest extends WindowTestsBase {
            }.setParent(mParent);
        }

        @Override
        public SurfaceControl getAnimationLeashParent() {
            return mParent;
        }

        @Override
        public SurfaceControl getSurfaceControl() {
            return mSurface;