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

Commit baac6507 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Fix issues with z-ordering during animations" into pi-dev

parents 727bc1e1 be418293
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1660,6 +1660,10 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
                true /* topToBottom */);
    }

    SurfaceControl getAppAnimationLayer() {
        return getAppAnimationLayer(needsZBoost());
    }

    @Override
    public SurfaceControl getAnimationLeashParent() {
        // All normal app transitions take place in an animation layer which is below the pinned
@@ -1855,7 +1859,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        leash.setLayer(layer);

        final DisplayContent dc = getDisplayContent();
        dc.assignStackOrdering(t);
        dc.assignStackOrdering();
        if (mAnimatingAppWindowTokenRegistry != null) {
            mAnimatingAppWindowTokenRegistry.notifyStarting(this);
        }
+19 −4
Original line number Diff line number Diff line
@@ -3180,6 +3180,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
         * A control placed at the appropriate level for transitions to occur.
         */
        SurfaceControl mAppAnimationLayer = null;
        SurfaceControl mBoostedAppAnimationLayer = null;

        /**
         * Given that the split-screen divider does not have an AppWindowToken, it
@@ -3531,12 +3532,14 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        }

        void assignStackOrdering(SurfaceControl.Transaction t) {

            final int HOME_STACK_STATE = 0;
            final int NORMAL_STACK_STATE = 1;
            final int ALWAYS_ON_TOP_STATE = 2;

            int layer = 0;
            int layerForAnimationLayer = 0;
            int layerForBoostedAnimationLayer = 0;

            for (int state = 0; state <= ALWAYS_ON_TOP_STATE; state++) {
                for (int i = 0; i < mChildren.size(); i++) {
@@ -3558,16 +3561,22 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
                        // highest animating stack and no higher.
                        layerForAnimationLayer = layer++;
                    }
                    if (state != ALWAYS_ON_TOP_STATE) {
                        layerForBoostedAnimationLayer = layer++;
                    }
                }
            }
            if (mAppAnimationLayer != null) {
                t.setLayer(mAppAnimationLayer, layerForAnimationLayer);
            }
            if (mBoostedAppAnimationLayer != null) {
                t.setLayer(mBoostedAppAnimationLayer, layerForBoostedAnimationLayer);
            }
        }

        @Override
        SurfaceControl getAppAnimationLayer() {
            return mAppAnimationLayer;
        SurfaceControl getAppAnimationLayer(boolean boosted) {
            return boosted ? mBoostedAppAnimationLayer : mAppAnimationLayer;
        }

        SurfaceControl getSplitScreenDividerAnchor() {
@@ -3581,16 +3590,22 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
                mAppAnimationLayer = makeChildSurface(null)
                        .setName("animationLayer")
                        .build();
                mBoostedAppAnimationLayer = makeChildSurface(null)
                        .setName("boostedAnimationLayer")
                        .build();
                mSplitScreenDividerAnchor = makeChildSurface(null)
                        .setName("splitScreenDividerAnchor")
                        .build();
                getPendingTransaction()
                        .show(mAppAnimationLayer)
                        .show(mBoostedAppAnimationLayer)
                        .show(mSplitScreenDividerAnchor);
                scheduleAnimation();
            } else {
                mAppAnimationLayer.destroy();
                mAppAnimationLayer = null;
                mBoostedAppAnimationLayer.destroy();
                mBoostedAppAnimationLayer = null;
                mSplitScreenDividerAnchor.destroy();
                mSplitScreenDividerAnchor = null;
            }
@@ -3872,7 +3887,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        super.prepareSurfaces();
    }

    void assignStackOrdering(SurfaceControl.Transaction t) {
        mTaskStackContainers.assignStackOrdering(t);
    void assignStackOrdering() {
        mTaskStackContainers.assignStackOrdering(getPendingTransaction());
    }
}
+5 −2
Original line number Diff line number Diff line
@@ -1125,12 +1125,15 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    }

    /**
     * @param boosted If true, returns an animation layer that happens above all {@link TaskStack}s
     *                Otherwise, the layer will be positioned above all animating
     *                {@link TaskStack}s.
     * @return The layer on which all app animations are happening.
     */
    SurfaceControl getAppAnimationLayer() {
    SurfaceControl getAppAnimationLayer(boolean boosted) {
        final WindowContainer parent = getParent();
        if (parent != null) {
            return parent.getAppAnimationLayer();
            return parent.getAppAnimationLayer(boosted);
        }
        return null;
    }