From 1e34808fec71834e8708136a8600c22f7ceb0a4a Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Thu, 30 Mar 2023 08:37:57 -0700 Subject: [PATCH] Add @hide IMM#getEnabledInputMethodSubtypeListAsUser() This CL adds an @hide method InputMethodManager#getEnabledInputMethodSubtypeListAsUser() so that bundled apps with INTERACT_ACROSS_USERS_FULL permission such as the Settings app can query about different users' IME subtypes. Bug: 275106096 Test: presubmit Change-Id: If5f2781b85e503cf059ef42102c09d99d6b9cb6b --- .../view/inputmethod/InputMethodManager.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 515b95cd951db..82cf07355a568 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -1648,6 +1648,7 @@ public final class InputMethodManager { * * @param userId user ID to query * @return {@link List} of {@link InputMethodInfo}. + * @see #getEnabledInputMethodSubtypeListAsUser(String, boolean, int) * @hide */ @RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true) @@ -1675,6 +1676,27 @@ public final class InputMethodManager { UserHandle.myUserId()); } + /** + * Returns a list of enabled input method subtypes for the specified input method info for the + * specified user. + * + * @param imeId IME ID to be queried about. + * @param allowsImplicitlyEnabledSubtypes {@code true} to include implicitly enabled subtypes. + * @param userId user ID to be queried about. + * {@link Manifest.permission#INTERACT_ACROSS_USERS_FULL} is required if this is + * different from the calling process user ID. + * @return {@link List} of {@link InputMethodSubtype}. + * @see #getEnabledInputMethodListAsUser(int) + * @hide + */ + @NonNull + @RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true) + public List getEnabledInputMethodSubtypeListAsUser( + @NonNull String imeId, boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId) { + return IInputMethodManagerGlobalInvoker.getEnabledInputMethodSubtypeList( + Objects.requireNonNull(imeId), allowsImplicitlyEnabledSubtypes, userId); + } + /** * @deprecated Use {@link InputMethodService#showStatusIcon(int)} instead. This method was * intended for IME developers who should be accessing APIs through the service. APIs in this