Reparent recents animation task leash to app animation layer

- When swiping up in split screen, the task is clipped by the unminimized
  stack bounds, instead reparent to app animation layer to allow it to be
  unconstrained. Currently, this will bump it up to the top, but we need
  a mechanism later to bump it only to under the primary splitscreen stack.

Bug: 73118672
Test: Swipe up from split screen, ensure app window is not clipped
Change-Id: Iacc6d6b82274b8b26b2dab85628479b5ff490817
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index e8d3210..95223d8 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -44,6 +44,7 @@
 import android.util.proto.ProtoOutputStream;
 import android.view.Surface;
 
+import android.view.SurfaceControl;
 import com.android.internal.annotations.VisibleForTesting;
 
 import java.io.PrintWriter;
@@ -559,6 +560,23 @@
                 && !mStack.isAnimatingBoundsToFullscreen() && !mPreserveNonFloatingState;
     }
 
+    @Override
+    public SurfaceControl getAnimationLeashParent() {
+        // Reparent to the animation layer so that we aren't clipped by the non-minimized
+        // stack bounds, currently we only animate the task for the recents animation
+        return getAppAnimationLayer(false /* boosted */);
+    }
+
+    boolean isTaskAnimating() {
+        final RecentsAnimationController recentsAnim = mService.getRecentsAnimationController();
+        if (recentsAnim != null) {
+            if (recentsAnim.isAnimatingTask(this)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     WindowState getTopVisibleAppMainWindow() {
         final AppWindowToken token = getTopVisibleAppToken();
         return token != null ? token.findMainWindow() : null;