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
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index fb93d39..c458c94 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -2178,9 +2178,9 @@
         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 @@
         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) {