From: Winson Chung Date: Fri, 20 Apr 2018 22:58:18 +0000 (-0700) Subject: Expose API to hide the IME during a recents animation X-Git-Tag: android-x86-9.0-r1~131^2~10^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a840c328e7305ba9492e699a8d6cc8794b2ab6ba;p=android-x86%2Fframeworks-base.git 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/core/java/android/view/IRecentsAnimationController.aidl b/core/java/android/view/IRecentsAnimationController.aidl index c0b40c8ceb3b..94b9bc099d56 100644 --- a/core/java/android/view/IRecentsAnimationController.aidl +++ b/core/java/android/view/IRecentsAnimationController.aidl @@ -64,4 +64,9 @@ interface IRecentsAnimationController { * Informs the system that the primary split-screen stack should be minimized. */ void setSplitScreenMinimized(boolean minimized); + + /** + * Hides the current input method if one is showing. + */ + void hideCurrentInputMethod(); } diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java index 80e226d929cd..9bebb14dabf0 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java @@ -69,6 +69,14 @@ public class RecentsAnimationControllerCompat { } } + public void hideCurrentInputMethod() { + try { + mAnimationController.hideCurrentInputMethod(); + } catch (RemoteException e) { + Log.e(TAG, "Failed to set hide input method", e); + } + } + public void finish(boolean toHome) { try { mAnimationController.finish(toHome); diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java index 79b230d45110..b057b1d8fb52 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.IRecentsAnimationRunner; 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 @@ public class RecentsAnimationController implements DeathRecipient { 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); + } + } }; /**