summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yohei Yukawa <yukawa@google.com> 2024-07-25 16:03:59 -0700
committer Yohei Yukawa <yukawa@google.com> 2024-07-25 16:03:59 -0700
commitd2ba2f53b844de278ab151d56e35963d12b215ef (patch)
tree27bae2b3e351ed3942b9fa3597687a61776aaab1
parente47b907e7887767480d28b84b83b2916db7b1d01 (diff)
Have displayId in IInputMethodManager#removeImeSurface
Otherwise InputMethodManagerService cannot determine whose IME needs to be interacted with in concurrent multi-user mode, where we in general assume UserManagerInternal.getUserAssignedToDisplay() would give the corresponding IME user ID. This CL is just plumbing a display ID. There must be no observable behavior change until we start using it in a subsequent CL. Bug: 350386877 Test: presubmit Test: atest WMShellUnitTests:DisplayImeControllerTest Flag: EXEMPT refactor Change-Id: Ie9b1d291b8e104aeca961d29f67be8870605ea4d
-rw-r--r--core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java8
-rw-r--r--core/java/android/view/inputmethod/InputMethodManagerGlobal.java6
-rw-r--r--core/java/com/android/internal/view/IInputMethodManager.aidl2
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java8
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/DisplayImeControllerTest.java2
-rw-r--r--services/core/java/com/android/server/inputmethod/IInputMethodManagerImpl.java6
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodManagerService.java2
-rw-r--r--services/core/java/com/android/server/inputmethod/ZeroJankProxy.java4
8 files changed, 22 insertions, 16 deletions
diff --git a/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java b/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java
index 07a97948e7fd..a4ca55ebf690 100644
--- a/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java
+++ b/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java
@@ -196,16 +196,20 @@ final class IInputMethodManagerGlobalInvoker {
/**
* Invokes {@link IInputMethodManager#removeImeSurface()}
+ *
+ * @param displayId display ID from which this request originates
+ * @param exceptionHandler an optional {@link RemoteException} handler
*/
@AnyThread
@RequiresPermission(Manifest.permission.INTERNAL_SYSTEM_WINDOW)
- static void removeImeSurface(@Nullable Consumer<RemoteException> exceptionHandler) {
+ static void removeImeSurface(int displayId,
+ @Nullable Consumer<RemoteException> exceptionHandler) {
final IInputMethodManager service = getService();
if (service == null) {
return;
}
try {
- service.removeImeSurface();
+ service.removeImeSurface(displayId);
} catch (RemoteException e) {
handleRemoteExceptionOrRethrow(e, exceptionHandler);
}
diff --git a/core/java/android/view/inputmethod/InputMethodManagerGlobal.java b/core/java/android/view/inputmethod/InputMethodManagerGlobal.java
index 5df9fd15c47a..244b2395d49f 100644
--- a/core/java/android/view/inputmethod/InputMethodManagerGlobal.java
+++ b/core/java/android/view/inputmethod/InputMethodManagerGlobal.java
@@ -95,11 +95,13 @@ public class InputMethodManagerGlobal {
/**
* Invokes {@link IInputMethodManager#removeImeSurface()}
*
+ * @param displayId display ID from which this request originates.
* @param exceptionHandler an optional {@link RemoteException} handler.
*/
@AnyThread
@RequiresPermission(Manifest.permission.INTERNAL_SYSTEM_WINDOW)
- public static void removeImeSurface(@Nullable Consumer<RemoteException> exceptionHandler) {
- IInputMethodManagerGlobalInvoker.removeImeSurface(exceptionHandler);
+ public static void removeImeSurface(int displayId,
+ @Nullable Consumer<RemoteException> exceptionHandler) {
+ IInputMethodManagerGlobalInvoker.removeImeSurface(displayId, exceptionHandler);
}
}
diff --git a/core/java/com/android/internal/view/IInputMethodManager.aidl b/core/java/com/android/internal/view/IInputMethodManager.aidl
index cba27ce3fe65..3f7ba0aa69eb 100644
--- a/core/java/com/android/internal/view/IInputMethodManager.aidl
+++ b/core/java/com/android/internal/view/IInputMethodManager.aidl
@@ -171,7 +171,7 @@ interface IInputMethodManager {
@EnforcePermission("INTERNAL_SYSTEM_WINDOW")
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
+ "android.Manifest.permission.INTERNAL_SYSTEM_WINDOW)")
- void removeImeSurface();
+ void removeImeSurface(int displayId);
/** Remove the IME surface. Requires passing the currently focused window. */
oneway void removeImeSurfaceFromWindowAsync(in IBinder windowToken);
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java
index 4fbb5744b64b..d7d19f7b8bbd 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java
@@ -315,7 +315,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
}
}
if (!mImeShowing) {
- removeImeSurface();
+ removeImeSurface(mDisplayId);
}
}
} else if (!android.view.inputmethod.Flags.refactorInsetsController()
@@ -617,7 +617,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
|| hasLeash) {
t.hide(mImeSourceControl.getLeash());
}
- removeImeSurface();
+ removeImeSurface(mDisplayId);
ImeTracker.forLogging().onHidden(mStatsToken);
} else if (mAnimationDirection == DIRECTION_SHOW && !mCancelled) {
ImeTracker.forLogging().onShown(mStatsToken);
@@ -671,10 +671,10 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
}
}
- void removeImeSurface() {
+ void removeImeSurface(int displayId) {
// Remove the IME surface to make the insets invisible for
// non-client controlled insets.
- InputMethodManagerGlobal.removeImeSurface(
+ InputMethodManagerGlobal.removeImeSurface(displayId,
e -> Slog.e(TAG, "Failed to remove IME surface.", e));
}
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/DisplayImeControllerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/DisplayImeControllerTest.java
index 2c0aa12f22d2..764d5a97e3e1 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/DisplayImeControllerTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/DisplayImeControllerTest.java
@@ -83,7 +83,7 @@ public class DisplayImeControllerTest extends ShellTestCase {
}
}, mExecutor) {
@Override
- void removeImeSurface() { }
+ void removeImeSurface(int displayId) { }
}.new PerDisplay(DEFAULT_DISPLAY, ROTATION_0);
}
diff --git a/services/core/java/com/android/server/inputmethod/IInputMethodManagerImpl.java b/services/core/java/com/android/server/inputmethod/IInputMethodManagerImpl.java
index a7280e6e99b4..7f7ae1071bfb 100644
--- a/services/core/java/com/android/server/inputmethod/IInputMethodManagerImpl.java
+++ b/services/core/java/com/android/server/inputmethod/IInputMethodManagerImpl.java
@@ -154,7 +154,7 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub {
void reportPerceptibleAsync(IBinder windowToken, boolean perceptible);
@PermissionVerified(Manifest.permission.INTERNAL_SYSTEM_WINDOW)
- void removeImeSurface();
+ void removeImeSurface(int displayId);
void removeImeSurfaceFromWindowAsync(IBinder windowToken);
@@ -384,10 +384,10 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub {
@EnforcePermission(Manifest.permission.INTERNAL_SYSTEM_WINDOW)
@Override
- public void removeImeSurface() {
+ public void removeImeSurface(int displayId) {
super.removeImeSurface_enforcePermission();
- mCallback.removeImeSurface();
+ mCallback.removeImeSurface(displayId);
}
@Override
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index d2140f83fb27..3a6ce68abaae 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -4360,7 +4360,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
@IInputMethodManagerImpl.PermissionVerified(Manifest.permission.INTERNAL_SYSTEM_WINDOW)
@Override
- public void removeImeSurface() {
+ public void removeImeSurface(int displayId) {
mHandler.obtainMessage(MSG_REMOVE_IME_SURFACE).sendToTarget();
}
diff --git a/services/core/java/com/android/server/inputmethod/ZeroJankProxy.java b/services/core/java/com/android/server/inputmethod/ZeroJankProxy.java
index 770e12d8e49a..927dd0e0ca0a 100644
--- a/services/core/java/com/android/server/inputmethod/ZeroJankProxy.java
+++ b/services/core/java/com/android/server/inputmethod/ZeroJankProxy.java
@@ -332,8 +332,8 @@ final class ZeroJankProxy implements IInputMethodManagerImpl.Callback {
@IInputMethodManagerImpl.PermissionVerified(Manifest.permission.INTERNAL_SYSTEM_WINDOW)
@Override
- public void removeImeSurface() {
- mInner.removeImeSurface();
+ public void removeImeSurface(int displayId) {
+ mInner.removeImeSurface(displayId);
}
@Override