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

Commit ed66434b authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Remove mNeedsZBoost" into main

parents 9a6b6d10 fadb0a19
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -3661,13 +3661,6 @@ final class ActivityRecord extends WindowToken {

                if (endTask) {
                    mAtmService.getLockTaskController().clearLockedTask(task);
                    // This activity was in the top focused root task and this is the last
                    // activity in that task, give this activity a higher layer so it can stay on
                    // top before the closing task transition be executed.
                    if (mayAdjustTop) {
                        mNeedsZBoost = true;
                        mDisplayContent.assignWindowLayers(false /* setLayoutNeeded */);
                    }
                }
            } else if (!isState(PAUSING)) {
                if (mVisibleRequested) {
@@ -7206,11 +7199,6 @@ final class ActivityRecord extends WindowToken {
        return candidate;
    }

    @Override
    boolean needsZBoost() {
        return mNeedsZBoost || super.needsZBoost();
    }

    @Override
    public SurfaceControl getAnimationLeashParent() {
        // For transitions in the root pinned task (menu activity) we just let them occur as a child
+0 −6
Original line number Diff line number Diff line
@@ -331,12 +331,6 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {
        return mChildren.size() - 1;
    }

    @Override
    boolean needsZBoost() {
        // Z Boost should only happen at or below the ActivityStack level.
        return false;
    }

    @Override
    boolean fillsParent() {
        return true;
+29 −39
Original line number Diff line number Diff line
@@ -3633,12 +3633,9 @@ class Task extends TaskFragment {
        int layer = 0;
        boolean decorSurfacePlaced = false;

        // We use two passes as a way to promote children which
        // need Z-boosting to the end of the list.
        for (int j = 0; j < mChildren.size(); ++j) {
            final WindowContainer wc = mChildren.get(j);
            wc.assignChildLayers(t);
            if (!wc.needsZBoost()) {
            // Place the decor surface under any untrusted content.
            if (mDecorSurfaceContainer != null
                    && !mDecorSurfaceContainer.mIsBoosted
@@ -3671,7 +3668,6 @@ class Task extends TaskFragment {
                decorSurfacePlaced = true;
            }
        }
        }

        // Boost the decor surface above other non-boosted windows if requested. The cover surface
        // will ensure that the content of the windows below are invisible.
@@ -3679,12 +3675,6 @@ class Task extends TaskFragment {
            mDecorSurfaceContainer.assignLayer(t, layer++);
        }

        for (int j = 0; j < mChildren.size(); ++j) {
            final WindowContainer wc = mChildren.get(j);
            if (wc.needsZBoost()) {
                wc.assignLayer(t, layer++);
            }
        }
        if (mOverlayHost != null) {
            mOverlayHost.setLayer(t, layer++);
        }
+0 −30
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import android.content.pm.ActivityInfo.ScreenOrientation;
import android.content.res.Configuration;
import android.graphics.Color;
import android.os.UserHandle;
import android.util.IntArray;
import android.util.Slog;
import android.view.SurfaceControl;
import android.view.WindowManager;
@@ -102,9 +101,6 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
    private final ArrayList<WindowContainer> mTmpAlwaysOnTopChildren = new ArrayList<>();
    private final ArrayList<WindowContainer> mTmpNormalChildren = new ArrayList<>();
    private final ArrayList<WindowContainer> mTmpHomeChildren = new ArrayList<>();
    private final IntArray mTmpNeedsZBoostIndexes = new IntArray();

    private ArrayList<Task> mTmpTasks = new ArrayList<>();

    private ActivityTaskManagerService mAtmService;

@@ -740,40 +736,14 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
     */
    private int adjustRootTaskLayer(SurfaceControl.Transaction t,
            ArrayList<WindowContainer> children, int startLayer) {
        mTmpNeedsZBoostIndexes.clear();
        final int childCount = children.size();
        boolean hasAdjacentTask = false;
        for (int i = 0; i < childCount; i++) {
            final WindowContainer child = children.get(i);
            final TaskDisplayArea childTda = child.asTaskDisplayArea();
            final boolean childNeedsZBoost = childTda != null
                    ? childTda.childrenNeedZBoost()
                    : child.needsZBoost();

            if (childNeedsZBoost) {
                mTmpNeedsZBoostIndexes.add(i);
                continue;
            }

            child.assignLayer(t, startLayer++);
        }

        final int zBoostSize = mTmpNeedsZBoostIndexes.size();
        for (int i = 0; i < zBoostSize; i++) {
            final WindowContainer child = children.get(mTmpNeedsZBoostIndexes.get(i));
            child.assignLayer(t, startLayer++);
        }
        return startLayer;
    }

    private boolean childrenNeedZBoost() {
        final boolean[] needsZBoost = new boolean[1];
        forAllRootTasks(task -> {
            needsZBoost[0] |= task.needsZBoost();
        });
        return needsZBoost[0];
    }

    void setBackgroundColor(@ColorInt int colorInt) {
        setBackgroundColor(colorInt, false /* restore */);
    }
+1 −24
Original line number Diff line number Diff line
@@ -279,9 +279,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
     */
    int mTransitFlags;

    /** Whether this container should be boosted at the top of all its siblings. */
    @VisibleForTesting boolean mNeedsZBoost;

    /** Layer used to constrain the animation to a container's stack bounds. */
    SurfaceControl mAnimationBoundsLayer;

@@ -2736,16 +2733,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        for (int j = 0; j < mChildren.size(); ++j) {
            final WindowContainer wc = mChildren.get(j);
            wc.assignChildLayers(t);
            if (!wc.needsZBoost()) {
            wc.assignLayer(t, layer++);
        }
        }
        for (int j = 0; j < mChildren.size(); ++j) {
            final WindowContainer wc = mChildren.get(j);
            if (wc.needsZBoost()) {
                wc.assignLayer(t, layer++);
            }
        }
        if (mOverlayHost != null) {
            mOverlayHost.setLayer(t, layer++);
        }
@@ -2756,16 +2745,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        scheduleAnimation();
    }

    boolean needsZBoost() {
        if (mNeedsZBoost) return true;
        for (int i = 0; i < mChildren.size(); i++) {
            if (mChildren.get(i).needsZBoost()) {
                return true;
            }
        }
        return false;
    }

    /**
     * Write to a protocol buffer output stream. Protocol buffer message definition is at
     * {@link com.android.server.wm.WindowContainerProto}.
@@ -3106,7 +3085,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    public void onAnimationLeashLost(Transaction t) {
        mLastLayer = -1;
        mAnimationLeash = null;
        mNeedsZBoost = false;
        reassignLayer(t);
        updateSurfacePosition(t);
    }
@@ -3132,7 +3110,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    protected void onAnimationFinished(@AnimationType int type, AnimationAdapter anim) {
        doAnimationFinished(type, anim);
        mWmService.onAnimationFinished();
        mNeedsZBoost = false;
    }

    /**
Loading