diff options
| author | 2024-07-22 18:15:54 +0000 | |
|---|---|---|
| committer | 2024-07-22 18:15:54 +0000 | |
| commit | 2bd50fa549df1cbd021e407b6d9ac494de2cee21 (patch) | |
| tree | 4003418d7010cd05ffe0480b9d46af29dd09b887 | |
| parent | df401875f19ae667afb83e2bd6623fd654c493c8 (diff) | |
Introduce IMMI#getEnabledInputMethodListAsUser()
This is a preparation before fixing Bug 354333072.
Apparently
InputMethodManagerInternal#getEnabledInputMethodListAsUser()
should have been there for
KeyboardLayoutManager#getImeInfoListForLayoutMapping(),
which needs to query each user's IME information from the
system_server [1].
This is an internal refactoring. There must be no behavior change
until the above new internal method starts being used.
[1]: I9057e793641950e2ad903404d591b4e517e91e38
c2e31eb49ac522be4b766d28276142a01e83f4cc
Bug: 354333072
Test: presubmit
Flag: EXEMPT refactor
Change-Id: I78292896d75e5e54e76ed5595f79d917e0a3818a
| -rw-r--r-- | services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java | 20 | ||||
| -rw-r--r-- | services/core/java/com/android/server/inputmethod/InputMethodManagerService.java | 11 |
2 files changed, 31 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java index c82e5be7c643..cc9f63048843 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java @@ -27,6 +27,7 @@ import android.inputmethodservice.InputMethodService; import android.os.IBinder; import android.view.inputmethod.InlineSuggestionsRequest; import android.view.inputmethod.InputMethodInfo; +import android.view.inputmethod.InputMethodSubtype; import com.android.internal.inputmethod.IAccessibilityInputMethodSession; import com.android.internal.inputmethod.InlineSuggestionsRequestCallback; @@ -100,6 +101,18 @@ public abstract class InputMethodManagerInternal { public abstract List<InputMethodInfo> getEnabledInputMethodListAsUser(@UserIdInt int userId); /** + * Returns the list of installed input methods that are enabled for the specified user. + * + * @param imiId IME ID to be queried about + * @param allowsImplicitlyEnabledSubtypes {@code true} to return the implicitly enabled subtypes + * @param userId the user ID to be queried about + * @return a list of {@link InputMethodSubtype} that are enabled for {@code userId} + */ + @NonNull + public abstract List<InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser( + String imiId, boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId); + + /** * Called by the Autofill Frameworks to request an {@link InlineSuggestionsRequest} from * the input method. * @@ -312,6 +325,13 @@ public abstract class InputMethodManagerInternal { return Collections.emptyList(); } + @NonNull + @Override + public List<InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser(String imiId, + boolean allowsImplicitlyEnabledSubtypes, int userId) { + return Collections.emptyList(); + } + @Override public void onCreateInlineSuggestionsRequest(@UserIdInt int userId, InlineSuggestionsRequestInfo requestInfo, diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index cbe202b5adc8..e8c15987751a 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -5865,6 +5865,17 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } + @NonNull + @Override + public List<InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser( + String imiId, boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId) { + synchronized (ImfLock.class) { + return getEnabledInputMethodSubtypeListLocked(imiId, + allowsImplicitlyEnabledSubtypes, + userId, Process.SYSTEM_UID); + } + } + @Override public void onCreateInlineSuggestionsRequest(@UserIdInt int userId, InlineSuggestionsRequestInfo requestInfo, InlineSuggestionsRequestCallback cb) { |