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/inputmethod/IImeTracker.aidl9
-rw-r--r--services/core/java/com/android/server/inputmethod/ImeTrackerService.java9
5 files changed, 46 insertions, 0 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index a73aa71a75b0..ca5d3eb4a292 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -3977,6 +3977,7 @@ package android.view.inputmethod {
public final class InputMethodManager {
method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public void addVirtualStylusIdForTestSession();
+ method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public void finishTrackingPendingImeVisibilityRequests();
method public int getDisplayId();
method @FlaggedApi("android.view.inputmethod.imm_userhandle_hostsidetests") @NonNull @RequiresPermission(value=android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional=true) public java.util.List<android.view.inputmethod.InputMethodInfo> getEnabledInputMethodListAsUser(@NonNull android.os.UserHandle);
method @FlaggedApi("android.view.inputmethod.imm_userhandle_hostsidetests") @NonNull @RequiresPermission(value=android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional=true) public java.util.List<android.view.inputmethod.InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser(@NonNull String, boolean, @NonNull android.os.UserHandle);
diff --git a/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java b/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java
index cedf8d04ed99..f454a6abf6a0 100644
--- a/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java
+++ b/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java
@@ -770,6 +770,20 @@ final class IInputMethodManagerGlobalInvoker {
}
@AnyThread
+ @RequiresPermission(Manifest.permission.TEST_INPUT_METHOD)
+ static void finishTrackingPendingImeVisibilityRequests() {
+ final var service = getImeTrackerService();
+ if (service == null) {
+ return;
+ }
+ try {
+ service.finishTrackingPendingImeVisibilityRequests();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ @AnyThread
@Nullable
private static IImeTracker getImeTrackerService() {
var trackerService = sTrackerServiceCache;
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index 8efb201d08d6..80b23969ed73 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -4316,6 +4316,19 @@ public final class InputMethodManager {
}
/**
+ * A test API for CTS to finish the tracking of any pending IME visibility requests. This
+ * won't stop the actual requests, but allows resetting the state when starting up test runs.
+ *
+ * @hide
+ */
+ @SuppressLint("UnflaggedApi") // @TestApi without associated feature.
+ @TestApi
+ @RequiresPermission(Manifest.permission.TEST_INPUT_METHOD)
+ public void finishTrackingPendingImeVisibilityRequests() {
+ IInputMethodManagerGlobalInvoker.finishTrackingPendingImeVisibilityRequests();
+ }
+
+ /**
* Show the settings for enabling subtypes of the specified input method.
*
* @param imiId An input method, whose subtypes settings will be shown. If imiId is null,
diff --git a/core/java/com/android/internal/inputmethod/IImeTracker.aidl b/core/java/com/android/internal/inputmethod/IImeTracker.aidl
index b45bc1c46967..ab4edb65780b 100644
--- a/core/java/com/android/internal/inputmethod/IImeTracker.aidl
+++ b/core/java/com/android/internal/inputmethod/IImeTracker.aidl
@@ -86,4 +86,13 @@ interface IImeTracker {
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
+ "android.Manifest.permission.TEST_INPUT_METHOD)")
boolean hasPendingImeVisibilityRequests();
+
+ /**
+ * Finishes the tracking of any pending IME visibility requests. This won't stop the actual
+ * requests, but allows resetting the state when starting up test runs.
+ */
+ @EnforcePermission("TEST_INPUT_METHOD")
+ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
+ + "android.Manifest.permission.TEST_INPUT_METHOD)")
+ oneway void finishTrackingPendingImeVisibilityRequests();
}
diff --git a/services/core/java/com/android/server/inputmethod/ImeTrackerService.java b/services/core/java/com/android/server/inputmethod/ImeTrackerService.java
index 85ab77355c9a..1c14fc1b08dd 100644
--- a/services/core/java/com/android/server/inputmethod/ImeTrackerService.java
+++ b/services/core/java/com/android/server/inputmethod/ImeTrackerService.java
@@ -165,6 +165,15 @@ public final class ImeTrackerService extends IImeTracker.Stub {
}
}
+ @EnforcePermission(Manifest.permission.TEST_INPUT_METHOD)
+ @Override
+ public void finishTrackingPendingImeVisibilityRequests() {
+ super.finishTrackingPendingImeVisibilityRequests_enforcePermission();
+ synchronized (mLock) {
+ mHistory.mLiveEntries.clear();
+ }
+ }
+
/**
* A circular buffer storing the most recent few {@link ImeTracker.Token} entries information.
*/