Adjust animation final crop bounds so it's in screen space.

The final crop bounds for animations should use the screen space bounds
instead of stack bounds. Adjust the bounds so they're offset by the
stack position.

Test: WindowAnimationSpec#testApply_clipAfterOffsetPosition
Change-Id: Ibfda5ab505ee3206175e5f59e82f1c16f78d19c4
Fixes: 71619195
diff --git a/services/core/java/com/android/server/wm/WindowAnimationSpec.java b/services/core/java/com/android/server/wm/WindowAnimationSpec.java
index 031b57b..0863ee9 100644
--- a/services/core/java/com/android/server/wm/WindowAnimationSpec.java
+++ b/services/core/java/com/android/server/wm/WindowAnimationSpec.java
@@ -89,7 +89,10 @@
         if (mStackClipMode == STACK_CLIP_NONE) {
             t.setWindowCrop(leash, tmp.transformation.getClipRect());
         } else if (mStackClipMode == STACK_CLIP_AFTER_ANIM) {
-            t.setFinalCrop(leash, mStackBounds);
+            mTmpRect.set(mStackBounds);
+            // Offset stack bounds to stack position so the final crop is in screen space.
+            mTmpRect.offsetTo(mPosition.x, mPosition.y);
+            t.setFinalCrop(leash, mTmpRect);
             t.setWindowCrop(leash, tmp.transformation.getClipRect());
         } else {
             mTmpRect.set(mStackBounds);