Expose API to hide the IME during a recents animation

Bug: 73285089
Test: Swipe up from app with IME open, ensure that it closes
Change-Id: I95ce59291f11285c853e8b3029638119c21f7e38
diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java
index 79b230d..b057b1d 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimationController.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java
@@ -47,7 +47,9 @@
 import android.view.RemoteAnimationTarget;
 import android.view.SurfaceControl;
 import android.view.SurfaceControl.Transaction;
+import android.view.inputmethod.InputMethodManagerInternal;
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.server.LocalServices;
 import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback;
 import com.android.server.wm.utils.InsetUtils;
 import com.google.android.collect.Sets;
@@ -220,6 +222,20 @@
                 Binder.restoreCallingIdentity(token);
             }
         }
+
+        @Override
+        public void hideCurrentInputMethod() {
+            final long token = Binder.clearCallingIdentity();
+            try {
+                final InputMethodManagerInternal inputMethodManagerInternal =
+                        LocalServices.getService(InputMethodManagerInternal.class);
+                if (inputMethodManagerInternal != null) {
+                    inputMethodManagerInternal.hideCurrentInputMethod();
+                }
+            } finally {
+                Binder.restoreCallingIdentity(token);
+            }
+        }
     };
 
     /**