Various pinned animation bug fixes.

First we need to change the way the aspect scale cropping happens
on the way down, previously we relied on the stack bounds to crop us
and did not expand the stack bounds for shadows. Now that the stack
surface bounds are expanded for shadows we have to do the additional
cropping required by this animation at the WSA level. Namely we interpolate
such that when the animation reaches 100% progress everything except
the source bounds will be cropped out. If we didn't do this we would see
a surfaceInsets sized sliver of the original app at the end of the animation.

A second fix is to update the stack bounds when changing windowing modes
to make sure we immediately expand for the pinned insets (as the WindowState
level may now immediately reposition to compensate).

A third fix is to correct the stack outset logic to match the client side
in WindowManager.java

A fourth fix is to bump the default and arbitrary surface size to allow
for surfaces slightly larger than full-screen and positioned at a negative
position, e.g. a full-screen-surface which retained it's insets due
to a slow or non-cooperative client.

Bug: 70666541
Test: Manual. go/wm-smoke.
Change-Id: I045ddf191cd3875f5d32c2e15da6e01fb50f3a01
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 19c634a..332bdb7 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -747,7 +747,14 @@
         mDividerControllerLocked = new DockedStackDividerController(service, this);
         mPinnedStackControllerLocked = new PinnedStackController(service, this);
 
-        mSurfaceSize = Math.max(mBaseDisplayHeight, mBaseDisplayWidth);
+        // We use this as our arbitrary surface size for buffer-less parents
+        // that don't impose cropping on their children. It may need to be larger
+        // than the display size because fullscreen windows can be shifted offscreen
+        // due to surfaceInsets. 2 times the largest display dimension feels like an
+        // appropriately arbitrary number. Eventually we would like to give SurfaceFlinger
+        // layers the ability to match their parent sizes and be able to skip
+        // such arbitrary size settings.
+        mSurfaceSize = Math.max(mBaseDisplayHeight, mBaseDisplayWidth) * 2;
 
         final SurfaceControl.Builder b = mService.makeSurfaceBuilder(mSession)
                 .setSize(mSurfaceSize, mSurfaceSize)