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

Commit 2a8a2c13 authored by Evan Rosky's avatar Evan Rosky Committed by Automerger Merge Worker
Browse files

Merge "Clean-up displayed-bounds" into rvc-dev am: 2556dbf3 am: b21ebd20 am: ed32893a

Change-Id: I4acb8da60f2cb1d8f244e247d492a52e65ffb28c
parents cf54ce7f ed32893a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -250,7 +250,7 @@ message TaskProto {
    reserved 3; // activity
    reserved 3; // activity
    optional bool fills_parent = 4;
    optional bool fills_parent = 4;
    optional .android.graphics.RectProto bounds = 5;
    optional .android.graphics.RectProto bounds = 5;
    optional .android.graphics.RectProto displayed_bounds = 6;
    optional .android.graphics.RectProto displayed_bounds = 6 [deprecated=true];
    optional bool defer_removal = 7;
    optional bool defer_removal = 7;
    optional int32 surface_width = 8;
    optional int32 surface_width = 8;
    optional int32 surface_height = 9;
    optional int32 surface_height = 9;
+2 −13
Original line number Original line Diff line number Diff line
@@ -1374,8 +1374,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            final Rect spaceToFill = transformedBounds != null
            final Rect spaceToFill = transformedBounds != null
                    ? transformedBounds
                    ? transformedBounds
                    : inMultiWindowMode()
                    : inMultiWindowMode()
                            ? task.getDisplayedBounds()
                            ? task.getBounds()
                            : getRootTask().getParent().getDisplayedBounds();
                            : getRootTask().getParent().getBounds();
            mLetterbox.layout(spaceToFill, w.getFrameLw(), mTmpPoint);
            mLetterbox.layout(spaceToFill, w.getFrameLw(), mTmpPoint);
        } else if (mLetterbox != null) {
        } else if (mLetterbox != null) {
            mLetterbox.hide();
            mLetterbox.hide();
@@ -6663,17 +6663,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        return super.getBounds();
        return super.getBounds();
    }
    }


    @Override
    Rect getDisplayedBounds() {
        if (task != null) {
            final Rect overrideDisplayedBounds = task.getOverrideDisplayedBounds();
            if (!overrideDisplayedBounds.isEmpty()) {
                return overrideDisplayedBounds;
            }
        }
        return getBounds();
    }

    @VisibleForTesting
    @VisibleForTesting
    @Override
    @Override
    Rect getAnimationBounds(int appStackClipMode) {
    Rect getAnimationBounds(int appStackClipMode) {
+9 −40
Original line number Original line Diff line number Diff line
@@ -91,7 +91,6 @@ import static com.android.server.wm.TaskProto.ANIMATING_BOUNDS;
import static com.android.server.wm.TaskProto.BOUNDS;
import static com.android.server.wm.TaskProto.BOUNDS;
import static com.android.server.wm.TaskProto.CREATED_BY_ORGANIZER;
import static com.android.server.wm.TaskProto.CREATED_BY_ORGANIZER;
import static com.android.server.wm.TaskProto.DEFER_REMOVAL;
import static com.android.server.wm.TaskProto.DEFER_REMOVAL;
import static com.android.server.wm.TaskProto.DISPLAYED_BOUNDS;
import static com.android.server.wm.TaskProto.DISPLAY_ID;
import static com.android.server.wm.TaskProto.DISPLAY_ID;
import static com.android.server.wm.TaskProto.FILLS_PARENT;
import static com.android.server.wm.TaskProto.FILLS_PARENT;
import static com.android.server.wm.TaskProto.LAST_NON_FULLSCREEN_BOUNDS;
import static com.android.server.wm.TaskProto.LAST_NON_FULLSCREEN_BOUNDS;
@@ -660,8 +659,7 @@ class ActivityStack extends Task {
                setBounds(newBounds);
                setBounds(newBounds);
            } else if (overrideWindowingMode != WINDOWING_MODE_PINNED) {
            } else if (overrideWindowingMode != WINDOWING_MODE_PINNED) {
                // For pinned stack, resize is now part of the {@link WindowContainerTransaction}
                // For pinned stack, resize is now part of the {@link WindowContainerTransaction}
                resize(new Rect(newBounds), null /* configBounds */,
                resize(new Rect(newBounds), PRESERVE_WINDOWS, true /* deferResume */);
                        PRESERVE_WINDOWS, true /* deferResume */);
            }
            }
        }
        }
        if (prevIsAlwaysOnTop != isAlwaysOnTop()) {
        if (prevIsAlwaysOnTop != isAlwaysOnTop()) {
@@ -835,8 +833,7 @@ class ActivityStack extends Task {
            }
            }


            if (!Objects.equals(getRequestedOverrideBounds(), mTmpRect2)) {
            if (!Objects.equals(getRequestedOverrideBounds(), mTmpRect2)) {
                resize(mTmpRect2, null /*configBounds*/,
                resize(mTmpRect2, false /*preserveWindows*/, true /*deferResume*/);
                        false /*preserveWindows*/, true /*deferResume*/);
            }
            }
        } finally {
        } finally {
            mAtmService.continueWindowLayout();
            mAtmService.continueWindowLayout();
@@ -894,9 +891,6 @@ class ActivityStack extends Task {
                setTaskBounds(mDeferredBounds);
                setTaskBounds(mDeferredBounds);
                setBounds(mDeferredBounds);
                setBounds(mDeferredBounds);
            }
            }
            if (mUpdateDisplayedBoundsDeferredCalled) {
                setTaskDisplayedBounds(mDeferredDisplayedBounds);
            }
        }
        }
    }
    }


@@ -2966,8 +2960,7 @@ class ActivityStack extends Task {


    // TODO: Can only be called from special methods in ActivityStackSupervisor.
    // TODO: Can only be called from special methods in ActivityStackSupervisor.
    // Need to consolidate those calls points into this resize method so anyone can call directly.
    // Need to consolidate those calls points into this resize method so anyone can call directly.
    void resize(Rect displayedBounds, Rect configBounds, boolean preserveWindows,
    void resize(Rect displayedBounds, boolean preserveWindows, boolean deferResume) {
            boolean deferResume) {
        if (!updateBoundsAllowed(displayedBounds)) {
        if (!updateBoundsAllowed(displayedBounds)) {
            return;
            return;
        }
        }
@@ -2979,7 +2972,7 @@ class ActivityStack extends Task {
            // Update override configurations of all tasks in the stack.
            // Update override configurations of all tasks in the stack.
            final PooledConsumer c = PooledLambda.obtainConsumer(
            final PooledConsumer c = PooledLambda.obtainConsumer(
                    ActivityStack::processTaskResizeBounds, PooledLambda.__(Task.class),
                    ActivityStack::processTaskResizeBounds, PooledLambda.__(Task.class),
                    displayedBounds, configBounds);
                    displayedBounds);
            forAllTasks(c, true /* traverseTopToBottom */);
            forAllTasks(c, true /* traverseTopToBottom */);
            c.recycle();
            c.recycle();


@@ -3000,18 +2993,11 @@ class ActivityStack extends Task {
        }
        }
    }
    }


    private static void processTaskResizeBounds(
    private static void processTaskResizeBounds(Task task, Rect displayedBounds) {
            Task task, Rect displayedBounds, Rect configBounds) {
        if (!task.isResizeable()) return;
        if (!task.isResizeable()) return;


        if (configBounds != null && !configBounds.isEmpty()) {
            task.setOverrideDisplayedBounds(displayedBounds);
            task.setBounds(configBounds);
        } else {
            task.setOverrideDisplayedBounds(null);
        task.setBounds(displayedBounds);
        task.setBounds(displayedBounds);
    }
    }
    }


    /**
    /**
     * Until we can break this "set task bounds to same as stack bounds" behavior, this
     * Until we can break this "set task bounds to same as stack bounds" behavior, this
@@ -3032,22 +3018,6 @@ class ActivityStack extends Task {
        task.setBounds(task.isResizeable() ? bounds : null);
        task.setBounds(task.isResizeable() ? bounds : null);
    }
    }


    /** Helper to setDisplayedBounds on all child tasks */
    private void setTaskDisplayedBounds(Rect bounds) {
        if (!updateDisplayedBoundsAllowed(bounds)) {
            return;
        }

        final PooledConsumer c = PooledLambda.obtainConsumer(ActivityStack::setTaskDisplayedBounds,
                PooledLambda.__(Task.class), bounds);
        forAllLeafTasks(c, true /* traverseTopToBottom */);
        c.recycle();
    }

    private static void setTaskDisplayedBounds(Task task, Rect bounds) {
        task.setOverrideDisplayedBounds(bounds == null || bounds.isEmpty() ? null : bounds);
    }

    /**
    /**
     * Returns the top-most activity that occludes the given one, or @{code null} if none.
     * Returns the top-most activity that occludes the given one, or @{code null} if none.
     */
     */
@@ -3569,8 +3539,8 @@ class ActivityStack extends Task {
    }
    }


    @Override
    @Override
    void getRelativeDisplayedPosition(Point outPos) {
    void getRelativePosition(Point outPos) {
        super.getRelativeDisplayedPosition(outPos);
        super.getRelativePosition(outPos);
        final int outset = getStackOutset();
        final int outset = getStackOutset();
        outPos.x -= outset;
        outPos.x -= outset;
        outPos.y -= outset;
        outPos.y -= outset;
@@ -3581,7 +3551,7 @@ class ActivityStack extends Task {
            return;
            return;
        }
        }


        final Rect stackBounds = getDisplayedBounds();
        final Rect stackBounds = getBounds();
        int width = stackBounds.width();
        int width = stackBounds.width();
        int height = stackBounds.height();
        int height = stackBounds.height();


@@ -3776,7 +3746,6 @@ class ActivityStack extends Task {
        proto.write(FILLS_PARENT, matchParentBounds());
        proto.write(FILLS_PARENT, matchParentBounds());
        getRawBounds().dumpDebug(proto, BOUNDS);
        getRawBounds().dumpDebug(proto, BOUNDS);


        getOverrideDisplayedBounds().dumpDebug(proto, DISPLAYED_BOUNDS);
        if (mLastNonFullscreenBounds != null) {
        if (mLastNonFullscreenBounds != null) {
            mLastNonFullscreenBounds.dumpDebug(proto, LAST_NON_FULLSCREEN_BOUNDS);
            mLastNonFullscreenBounds.dumpDebug(proto, LAST_NON_FULLSCREEN_BOUNDS);
        }
        }
+1 −1
Original line number Original line Diff line number Diff line
@@ -1357,7 +1357,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
                // still need moveTaskToFrontLocked() below for any transition settings.
                // still need moveTaskToFrontLocked() below for any transition settings.
            }
            }
            if (stack.shouldResizeStackWithLaunchBounds()) {
            if (stack.shouldResizeStackWithLaunchBounds()) {
                stack.resize(bounds, null /* configBounds */, !PRESERVE_WINDOWS, !DEFER_RESUME);
                stack.resize(bounds, !PRESERVE_WINDOWS, !DEFER_RESUME);
            } else {
            } else {
                // WM resizeTask must be done after the task is moved to the correct stack,
                // WM resizeTask must be done after the task is moved to the correct stack,
                // because Task's setBounds() also updates dim layer's bounds, but that has
                // because Task's setBounds() also updates dim layer's bounds, but that has
+2 −2
Original line number Original line Diff line number Diff line
@@ -898,11 +898,11 @@ public class RecentsAnimationController implements DeathRecipient {
        TaskAnimationAdapter(Task task, boolean isRecentTaskInvisible) {
        TaskAnimationAdapter(Task task, boolean isRecentTaskInvisible) {
            mTask = task;
            mTask = task;
            mIsRecentTaskInvisible = isRecentTaskInvisible;
            mIsRecentTaskInvisible = isRecentTaskInvisible;
            mBounds.set(mTask.getDisplayedBounds());
            mBounds.set(mTask.getBounds());


            mLocalBounds.set(mBounds);
            mLocalBounds.set(mBounds);
            Point tmpPos = new Point();
            Point tmpPos = new Point();
            mTask.getRelativeDisplayedPosition(tmpPos);
            mTask.getRelativePosition(tmpPos);
            mLocalBounds.offsetTo(tmpPos.x, tmpPos.y);
            mLocalBounds.offsetTo(tmpPos.x, tmpPos.y);
        }
        }


Loading