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

Commit ed6767fe authored by Evan Rosky's avatar Evan Rosky
Browse files

Move policy handling into ATM hierarchy [2/n]

Start removing concept of "insetBounds".

This is an important step in moving policy into the hierarchy since it
represents a codepath that resolves configuration with more data than
what is in the hierarchy (passing in 2-3 sets of bounds instead of 1).
In theory, we shouldn't need this as the extra bounds are only used
during transitionary periods (animation/interactive dragging).
Previously, we set the whole hierarchy to have the "displayed" bounds
and then fed in "insetBounds" to be used for the actual configuration
update. This is a backwards abstraction and a little wasteful since what
we actually want to do is prevent the configuration from updating and
change only how/where the eventual window is displayed.

This CL is a first step which introduces mDisplayedBounds to represent
the Task's bounds during transient periods. This way we can leave the
hierarchy in a steady state and use the displayed bounds to move it
around on screen. These displayedBounds are then used to position the
surface and the computed frame so that we aren't recalculating the
hierarchy (and passing "inset" bounds around) for transient operations.

Bug: 113900640
Bug: 119687367
Test: go/wm-smoke and wmtests/servicestests
Change-Id: Ia70d3e260e9ed6e2c2c8c19920025fd10fab9e17
parent 5e9f426f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -211,7 +211,7 @@ message TaskProto {
    repeated AppWindowTokenProto app_window_tokens = 3;
    optional bool fills_parent = 4;
    optional .android.graphics.RectProto bounds = 5;
    optional .android.graphics.RectProto temp_inset_bounds = 6;
    optional .android.graphics.RectProto displayed_bounds = 6;
    optional bool defer_removal = 7;
    optional int32 surface_width = 8;
    optional int32 surface_height = 9;
+1 −1
Original line number Diff line number Diff line
@@ -2543,7 +2543,7 @@ final class ActivityRecord extends ConfigurationContainer {

        // Bounds changed...update configuration to match.
        if (!matchParentBounds()) {
            task.computeOverrideConfiguration(mTmpConfig, updatedBounds, null /* insetBounds */,
            task.computeOverrideConfiguration(mTmpConfig, updatedBounds,
                    false /* overrideWidth */, false /* overrideHeight */);
        }

+6 −3
Original line number Diff line number Diff line
@@ -4944,9 +4944,12 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                }
            }

            if (task.hasDisplayedBounds()) {
                mTmpBounds.put(task.taskId, task.getDisplayedBounds());
                mTmpInsetBounds.put(task.taskId, task.getOverrideBounds());
            } else {
                mTmpBounds.put(task.taskId, task.getOverrideBounds());
            if (tempTaskInsetBounds != null) {
                mTmpInsetBounds.put(task.taskId, tempTaskInsetBounds);
                mTmpInsetBounds.put(task.taskId, null);
            }
        }

+14 −2
Original line number Diff line number Diff line
@@ -2178,9 +2178,9 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        final TaskStack stack = getStack();
        final Task task = getTask();
        if (task != null && task.inFreeformWindowingMode()) {
            task.getRelativePosition(outPosition);
            task.getRelativeDisplayedPosition(outPosition);
        } else if (stack != null) {
            stack.getRelativePosition(outPosition);
            stack.getRelativeDisplayedPosition(outPosition);
        }

        // Always use stack bounds in order to have the ability to animate outside the task region.
@@ -2193,6 +2193,18 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        outBounds.offsetTo(0, 0);
    }

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

    boolean applyAnimationLocked(WindowManager.LayoutParams lp, int transit, boolean enter,
            boolean isVoiceInteraction) {

+2 −2
Original line number Diff line number Diff line
@@ -603,8 +603,8 @@ public class RecentsAnimationController implements DeathRecipient {
            mTask = task;
            mIsRecentTaskInvisible = isRecentTaskInvisible;
            final WindowContainer container = mTask.getParent();
            container.getRelativePosition(mPosition);
            container.getBounds(mBounds);
            container.getRelativeDisplayedPosition(mPosition);
            mBounds.set(container.getDisplayedBounds());
        }

        RemoteAnimationTarget createRemoteAnimationApp() {
Loading