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

Commit fadb0a19 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Remove mNeedsZBoost

1. Now the transition layer is assigned by
   com.android.wm.shell.transition.Transitions#setupAnimHierarchy.
2. Currently it is only set on last finishing activity of a task, and
   it won't be unset because ActivityRecord no longer runs transition
   animation in WM core.

Bug: 365884835
Flag: EXEMPT remove unused code
Test: CtsWindowManagerDeviceWindow
Change-Id: Iea7a3a8739138cd536b1cfde11040192d8ce155d
parent f6992ead
Loading
Loading
Loading
Loading
+0 −12
Original line number Original line Diff line number Diff line
@@ -3665,13 +3665,6 @@ final class ActivityRecord extends WindowToken {


                if (endTask) {
                if (endTask) {
                    mAtmService.getLockTaskController().clearLockedTask(task);
                    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)) {
            } else if (!isState(PAUSING)) {
                if (mVisibleRequested) {
                if (mVisibleRequested) {
@@ -7233,11 +7226,6 @@ final class ActivityRecord extends WindowToken {
        return candidate;
        return candidate;
    }
    }


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

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


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

    @Override
    @Override
    boolean fillsParent() {
    boolean fillsParent() {
        return true;
        return true;
+29 −39
Original line number Original line Diff line number Diff line
@@ -3607,12 +3607,9 @@ class Task extends TaskFragment {
        int layer = 0;
        int layer = 0;
        boolean decorSurfacePlaced = false;
        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) {
        for (int j = 0; j < mChildren.size(); ++j) {
            final WindowContainer wc = mChildren.get(j);
            final WindowContainer wc = mChildren.get(j);
            wc.assignChildLayers(t);
            wc.assignChildLayers(t);
            if (!wc.needsZBoost()) {
            // Place the decor surface under any untrusted content.
            // Place the decor surface under any untrusted content.
            if (mDecorSurfaceContainer != null
            if (mDecorSurfaceContainer != null
                    && !mDecorSurfaceContainer.mIsBoosted
                    && !mDecorSurfaceContainer.mIsBoosted
@@ -3645,7 +3642,6 @@ class Task extends TaskFragment {
                decorSurfacePlaced = true;
                decorSurfacePlaced = true;
            }
            }
        }
        }
        }


        // Boost the decor surface above other non-boosted windows if requested. The cover surface
        // 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.
        // will ensure that the content of the windows below are invisible.
@@ -3653,12 +3649,6 @@ class Task extends TaskFragment {
            mDecorSurfaceContainer.assignLayer(t, layer++);
            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) {
        if (mOverlayHost != null) {
            mOverlayHost.setLayer(t, layer++);
            mOverlayHost.setLayer(t, layer++);
        }
        }
+0 −30
Original line number Original line Diff line number Diff line
@@ -48,7 +48,6 @@ import android.content.pm.ActivityInfo.ScreenOrientation;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.Color;
import android.os.UserHandle;
import android.os.UserHandle;
import android.util.IntArray;
import android.util.Slog;
import android.util.Slog;
import android.view.SurfaceControl;
import android.view.SurfaceControl;
import android.view.WindowManager;
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> mTmpAlwaysOnTopChildren = new ArrayList<>();
    private final ArrayList<WindowContainer> mTmpNormalChildren = new ArrayList<>();
    private final ArrayList<WindowContainer> mTmpNormalChildren = new ArrayList<>();
    private final ArrayList<WindowContainer> mTmpHomeChildren = new ArrayList<>();
    private final ArrayList<WindowContainer> mTmpHomeChildren = new ArrayList<>();
    private final IntArray mTmpNeedsZBoostIndexes = new IntArray();

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


    private ActivityTaskManagerService mAtmService;
    private ActivityTaskManagerService mAtmService;


@@ -740,40 +736,14 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
     */
     */
    private int adjustRootTaskLayer(SurfaceControl.Transaction t,
    private int adjustRootTaskLayer(SurfaceControl.Transaction t,
            ArrayList<WindowContainer> children, int startLayer) {
            ArrayList<WindowContainer> children, int startLayer) {
        mTmpNeedsZBoostIndexes.clear();
        final int childCount = children.size();
        final int childCount = children.size();
        boolean hasAdjacentTask = false;
        for (int i = 0; i < childCount; i++) {
        for (int i = 0; i < childCount; i++) {
            final WindowContainer child = children.get(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++);
            child.assignLayer(t, startLayer++);
        }
        }
        return 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) {
    void setBackgroundColor(@ColorInt int colorInt) {
        setBackgroundColor(colorInt, false /* restore */);
        setBackgroundColor(colorInt, false /* restore */);
    }
    }
+1 −24
Original line number Original line Diff line number Diff line
@@ -279,9 +279,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
     */
     */
    int mTransitFlags;
    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. */
    /** Layer used to constrain the animation to a container's stack bounds. */
    SurfaceControl mAnimationBoundsLayer;
    SurfaceControl mAnimationBoundsLayer;


@@ -2744,16 +2741,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        for (int j = 0; j < mChildren.size(); ++j) {
        for (int j = 0; j < mChildren.size(); ++j) {
            final WindowContainer wc = mChildren.get(j);
            final WindowContainer wc = mChildren.get(j);
            wc.assignChildLayers(t);
            wc.assignChildLayers(t);
            if (!wc.needsZBoost()) {
            wc.assignLayer(t, layer++);
            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) {
        if (mOverlayHost != null) {
            mOverlayHost.setLayer(t, layer++);
            mOverlayHost.setLayer(t, layer++);
        }
        }
@@ -2764,16 +2753,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        scheduleAnimation();
        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
     * Write to a protocol buffer output stream. Protocol buffer message definition is at
     * {@link com.android.server.wm.WindowContainerProto}.
     * {@link com.android.server.wm.WindowContainerProto}.
@@ -3114,7 +3093,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    public void onAnimationLeashLost(Transaction t) {
    public void onAnimationLeashLost(Transaction t) {
        mLastLayer = -1;
        mLastLayer = -1;
        mAnimationLeash = null;
        mAnimationLeash = null;
        mNeedsZBoost = false;
        reassignLayer(t);
        reassignLayer(t);
        updateSurfacePosition(t);
        updateSurfacePosition(t);
    }
    }
@@ -3140,7 +3118,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    protected void onAnimationFinished(@AnimationType int type, AnimationAdapter anim) {
    protected void onAnimationFinished(@AnimationType int type, AnimationAdapter anim) {
        doAnimationFinished(type, anim);
        doAnimationFinished(type, anim);
        mWmService.onAnimationFinished();
        mWmService.onAnimationFinished();
        mNeedsZBoost = false;
    }
    }


    /**
    /**
Loading