summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/test-current.txt1
-rw-r--r--core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java14
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java13
-rw-r--r--core/java/com/android/internal/view/IInputMethodManager.aidl9
-rw-r--r--services/core/java/com/android/server/inputmethod/IInputMethodManagerImpl.java11
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodManagerService.java14
-rw-r--r--services/core/java/com/android/server/inputmethod/ZeroJankProxy.java6
7 files changed, 68 insertions, 0 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index f98fb4642bd1..ed8042d45243 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -4136,6 +4136,7 @@ package android.view.inputmethod {
method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public boolean isInputMethodPickerShown();
method @NonNull @RequiresPermission(value=android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional=true) public boolean isStylusHandwritingAvailableAsUser(@NonNull android.os.UserHandle);
method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public void setStylusWindowIdleTimeoutForTest(long);
+ method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public boolean shouldShowImeSwitcherButtonForTest();
field public static final long CLEAR_SHOW_FORCED_FLAG_WHEN_LEAVING = 214016041L; // 0xcc1a029L
}
diff --git a/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java b/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java
index 3a008aad59bf..eca798d6eb4f 100644
--- a/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java
+++ b/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java
@@ -490,6 +490,20 @@ final class IInputMethodManagerGlobalInvoker {
}
@AnyThread
+ @RequiresPermission(Manifest.permission.TEST_INPUT_METHOD)
+ static boolean shouldShowImeSwitcherButtonForTest() {
+ final IInputMethodManager service = getService();
+ if (service == null) {
+ return false;
+ }
+ try {
+ return service.shouldShowImeSwitcherButtonForTest();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ @AnyThread
@Nullable
@RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)
static InputMethodSubtype getCurrentInputMethodSubtype(@UserIdInt int userId) {
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index d5f471edfdd2..eaa8f60e83a7 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -4536,6 +4536,19 @@ public final class InputMethodManager {
}
/**
+ * A test API for CTS to check whether the IME Switcher button should be shown when the IME
+ * is shown.
+ *
+ * @hide
+ */
+ @SuppressLint("UnflaggedApi") // @TestApi without associated feature.
+ @TestApi
+ @RequiresPermission(Manifest.permission.TEST_INPUT_METHOD)
+ public boolean shouldShowImeSwitcherButtonForTest() {
+ return IInputMethodManagerGlobalInvoker.shouldShowImeSwitcherButtonForTest();
+ }
+
+ /**
* A test API for CTS to check whether there are any pending IME visibility requests.
*
* @return {@code true} iff there are pending IME visibility requests.
diff --git a/core/java/com/android/internal/view/IInputMethodManager.aidl b/core/java/com/android/internal/view/IInputMethodManager.aidl
index efbf88714453..9380d99b7de3 100644
--- a/core/java/com/android/internal/view/IInputMethodManager.aidl
+++ b/core/java/com/android/internal/view/IInputMethodManager.aidl
@@ -149,6 +149,15 @@ interface IInputMethodManager {
+ "permission.WRITE_SECURE_SETTINGS, android.Manifest.permission.INTERACT_ACROSS_USERS_FULL})")
oneway void onImeSwitchButtonClickFromSystem(int displayId);
+ /**
+ * A test API for CTS to check whether the IME Switcher button should be shown when the IME
+ * is shown.
+ */
+ @EnforcePermission("TEST_INPUT_METHOD")
+ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
+ + "android.Manifest.permission.TEST_INPUT_METHOD)")
+ boolean shouldShowImeSwitcherButtonForTest();
+
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
+ "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)")
@nullable InputMethodSubtype getCurrentInputMethodSubtype(int userId);
diff --git a/services/core/java/com/android/server/inputmethod/IInputMethodManagerImpl.java b/services/core/java/com/android/server/inputmethod/IInputMethodManagerImpl.java
index e1f26d6e0cbc..a8b61af61cf2 100644
--- a/services/core/java/com/android/server/inputmethod/IInputMethodManagerImpl.java
+++ b/services/core/java/com/android/server/inputmethod/IInputMethodManagerImpl.java
@@ -159,6 +159,9 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub {
Manifest.permission.WRITE_SECURE_SETTINGS})
void onImeSwitchButtonClickFromSystem(int displayId);
+ @PermissionVerified(Manifest.permission.TEST_INPUT_METHOD)
+ boolean shouldShowImeSwitcherButtonForTest();
+
InputMethodSubtype getCurrentInputMethodSubtype(@UserIdInt int userId);
void setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes,
@@ -380,6 +383,14 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub {
mCallback.onImeSwitchButtonClickFromSystem(displayId);
}
+ @EnforcePermission(Manifest.permission.TEST_INPUT_METHOD)
+ @Override
+ public boolean shouldShowImeSwitcherButtonForTest() {
+ super.shouldShowImeSwitcherButtonForTest_enforcePermission();
+
+ return mCallback.shouldShowImeSwitcherButtonForTest();
+ }
+
@Override
public InputMethodSubtype getCurrentInputMethodSubtype(@UserIdInt int userId) {
return mCallback.getCurrentInputMethodSubtype(userId);
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index c653dec1a299..1f414ac07ba3 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -4129,6 +4129,20 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
}
}
+ /**
+ * A test API for CTS to check whether the IME Switcher button should be shown when the IME
+ * is shown.
+ */
+ @IInputMethodManagerImpl.PermissionVerified(Manifest.permission.TEST_INPUT_METHOD)
+ public boolean shouldShowImeSwitcherButtonForTest() {
+ final int callingUserId = UserHandle.getCallingUserId();
+ synchronized (ImfLock.class) {
+ final int userId = resolveImeUserIdLocked(callingUserId);
+ return shouldShowImeSwitcherLocked(
+ InputMethodService.IME_ACTIVE | InputMethodService.IME_VISIBLE, userId);
+ }
+ }
+
@NonNull
private static IllegalArgumentException getExceptionForUnknownImeId(
@Nullable String imeId) {
diff --git a/services/core/java/com/android/server/inputmethod/ZeroJankProxy.java b/services/core/java/com/android/server/inputmethod/ZeroJankProxy.java
index 49d4332d9e2a..b863c96facee 100644
--- a/services/core/java/com/android/server/inputmethod/ZeroJankProxy.java
+++ b/services/core/java/com/android/server/inputmethod/ZeroJankProxy.java
@@ -302,6 +302,12 @@ final class ZeroJankProxy implements IInputMethodManagerImpl.Callback {
mInner.onImeSwitchButtonClickFromSystem(displayId);
}
+ @IInputMethodManagerImpl.PermissionVerified(Manifest.permission.TEST_INPUT_METHOD)
+ @Override
+ public boolean shouldShowImeSwitcherButtonForTest() {
+ return mInner.shouldShowImeSwitcherButtonForTest();
+ }
+
@Override
public InputMethodSubtype getCurrentInputMethodSubtype(int userId) {
return mInner.getCurrentInputMethodSubtype(userId);