From 9e134c89700814d239fd39a67beb3c813b4e34d5 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Tue, 26 Jul 2022 07:55:57 +0900 Subject: [PATCH] Simplify IMMS#getEnabledInputMethodSubtypeList() a bit This is a follow up CL to my previous CL [1], which let query APIs defined in InputMethodManager support background users. Basically UserHandle.getCallingUserId() never returns a pseudo user ID such as UserHandle#USER_CURRENT. Hence there is no need to use InputMethodUtils.resolveUserId there. There should be no developer observable behavior change. [1]: I192a0f5a1375170d17a4c08af94f23966dbaea8b 7f8ee4b9ddd31ad36a12c5278b27990dc76011cc Bug: 122164939 Bug: 234882948 Test: make -j CtsInputMethod1 \ CtsInputMethod2 \ CtsInputMethodServiceDeviceTests \ CtsInputMethodServiceEventProvider \ CtsInputMethodServiceHostTestCases \ EditTextApp && atest CtsInputMethodServiceHostTestCases Change-Id: I85da7d819b6fba01fce1e5df1347534febf9aa53 --- .../server/inputmethod/InputMethodManagerService.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index cddbad64f2fdd..74eb91afb4bf2 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -2208,15 +2208,10 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub boolean allowsImplicitlySelectedSubtypes) { final int callingUserId = UserHandle.getCallingUserId(); synchronized (ImfLock.class) { - final int[] resolvedUserIds = InputMethodUtils.resolveUserId(callingUserId, - mSettings.getCurrentUserId(), null); - if (resolvedUserIds.length != 1) { - return Collections.emptyList(); - } final long ident = Binder.clearCallingIdentity(); try { return getEnabledInputMethodSubtypeListLocked(imiId, - allowsImplicitlySelectedSubtypes, resolvedUserIds[0]); + allowsImplicitlySelectedSubtypes, callingUserId); } finally { Binder.restoreCallingIdentity(ident); }