Revert "Revert "Elevate remote/recents animation priority""

This reverts commit a8b48ab7332f61afe37b2e866e9cb67421fab1c0.

Original issue has been fixed in follow up CL.

Bug: 73555925
Change-Id: Ie0a157a91c3c66df52370adad7b188f59c4749ea
diff --git a/services/core/java/com/android/server/wm/RemoteAnimationController.java b/services/core/java/com/android/server/wm/RemoteAnimationController.java
index ed6e606..e4bb043 100644
--- a/services/core/java/com/android/server/wm/RemoteAnimationController.java
+++ b/services/core/java/com/android/server/wm/RemoteAnimationController.java
@@ -103,6 +103,7 @@
                 onAnimationFinished();
             }
         });
+        sendRunningRemoteAnimation(true);
     }
 
     private RemoteAnimationTarget[] createAnimations() {
@@ -131,6 +132,7 @@
                 mService.closeSurfaceTransaction("RemoteAnimationController#finished");
             }
         }
+        sendRunningRemoteAnimation(false);
     }
 
     private void invokeAnimationCancelled() {
@@ -148,6 +150,14 @@
         }
     }
 
+    private void sendRunningRemoteAnimation(boolean running) {
+        final int pid = mRemoteAnimationAdapter.getCallingPid();
+        if (pid == 0) {
+            throw new RuntimeException("Calling pid of remote animation was null");
+        }
+        mService.sendSetRunningRemoteAnimation(pid, running);
+    }
+
     private static final class FinishedCallback extends IRemoteAnimationFinishedCallback.Stub {
 
         RemoteAnimationController mOuter;
@@ -251,6 +261,7 @@
                 mHandler.removeCallbacks(mTimeoutRunnable);
                 releaseFinishedCallback();
                 invokeAnimationCancelled();
+                sendRunningRemoteAnimation(false);
             }
         }