Allow recents animation to override divider minimized state

- When swiping up while in split-screen, the animation should be able to
  adjust the docked divider minimized state so that we don't wait until
  launcher is repositioned to the front in order for the divider to
  update.

Bug: 73118672
Test: Enter split screen, swipe up and ensure the dock divider moves
      (Note, there are still unrelated clipping issues)

Change-Id: Id71f91eaf2f06b3c33628a2199cc94c82e235471
diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java
index 29077f9..b12c36e 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimationController.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java
@@ -98,12 +98,16 @@
     private boolean mPendingStart = true;
 
     // Set when the animation has been canceled
-    private boolean mCanceled = false;
+    private boolean mCanceled;
 
     // Whether or not the input consumer is enabled. The input consumer must be both registered and
     // enabled for it to start intercepting touch events.
     private boolean mInputConsumerEnabled;
 
+    // Whether or not the recents animation should cause the primary split-screen stack to be
+    // minimized
+    private boolean mSplitScreenMinimized;
+
     private Rect mTmpRect = new Rect();
 
     public interface RecentsAnimationCallbacks {
@@ -116,7 +120,7 @@
         @Override
         public TaskSnapshot screenshotTask(int taskId) {
             if (DEBUG) Log.d(TAG, "screenshotTask(" + taskId + "): mCanceled=" + mCanceled);
-            long token = Binder.clearCallingIdentity();
+            final long token = Binder.clearCallingIdentity();
             try {
                 synchronized (mService.getWindowManagerLock()) {
                     if (mCanceled) {
@@ -145,7 +149,7 @@
         @Override
         public void finish(boolean moveHomeToTop) {
             if (DEBUG) Log.d(TAG, "finish(" + moveHomeToTop + "): mCanceled=" + mCanceled);
-            long token = Binder.clearCallingIdentity();
+            final long token = Binder.clearCallingIdentity();
             try {
                 synchronized (mService.getWindowManagerLock()) {
                     if (mCanceled) {
@@ -166,7 +170,7 @@
         @Override
         public void setAnimationTargetsBehindSystemBars(boolean behindSystemBars)
                 throws RemoteException {
-            long token = Binder.clearCallingIdentity();
+            final long token = Binder.clearCallingIdentity();
             try {
                 synchronized (mService.getWindowManagerLock()) {
                     for (int i = mPendingAnimations.size() - 1; i >= 0; i--) {
@@ -183,7 +187,7 @@
         public void setInputConsumerEnabled(boolean enabled) {
             if (DEBUG) Log.d(TAG, "setInputConsumerEnabled(" + enabled + "): mCanceled="
                     + mCanceled);
-            long token = Binder.clearCallingIdentity();
+            final long token = Binder.clearCallingIdentity();
             try {
                 synchronized (mService.getWindowManagerLock()) {
                     if (mCanceled) {
@@ -198,6 +202,23 @@
                 Binder.restoreCallingIdentity(token);
             }
         }
+
+        @Override
+        public void setSplitScreenMinimized(boolean minimized) {
+            final long token = Binder.clearCallingIdentity();
+            try {
+                synchronized (mService.getWindowManagerLock()) {
+                    if (mCanceled) {
+                        return;
+                    }
+
+                    mSplitScreenMinimized = minimized;
+                    mService.checkSplitScreenMinimizedChanged(true /* animate */);
+                }
+            } finally {
+                Binder.restoreCallingIdentity(token);
+            }
+        }
     };
 
     /**
@@ -330,6 +351,7 @@
                 Slog.e(TAG, "Failed to cancel recents animation", e);
             }
         }
+
         // Clean up and return to the previous app
         // Don't hold the WM lock here as it calls back to AM/RecentsAnimation
         mCallbacks.onAnimationFinished(reorderMode);
@@ -350,7 +372,7 @@
         mPendingAnimations.clear();
 
         mRunner.asBinder().unlinkToDeath(this, 0);
-
+        // Clear associated input consumers
         mService.mInputMonitor.updateInputWindowsLw(true /*force*/);
         mService.destroyInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION);
     }
@@ -375,6 +397,10 @@
         }
     }
 
+    boolean isSplitScreenMinimized() {
+        return mSplitScreenMinimized;
+    }
+
     boolean isWallpaperVisible(WindowState w) {
         return w != null && w.mAppToken != null && mHomeAppToken == w.mAppToken
                 && isHomeAppOverWallpaper();