Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +10 −36 Original line number Diff line number Diff line Loading @@ -5442,47 +5442,21 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub */ @GuardedBy("ImfLock.class") private InputMethodInfo queryDefaultInputMethodForUserIdLocked(@UserIdInt int userId) { final String imeId = mSettings.getSelectedInputMethodForUser(userId); if (TextUtils.isEmpty(imeId)) { Slog.e(TAG, "No default input method found for userId " + userId); return null; } InputMethodInfo curInputMethodInfo; if (userId == mSettings.getCurrentUserId() && (curInputMethodInfo = mMethodMap.get(imeId)) != null) { // clone the InputMethodInfo before returning. return new InputMethodInfo(curInputMethodInfo); if (userId == mSettings.getCurrentUserId()) { return mMethodMap.get(mSettings.getSelectedInputMethod()); } final ArrayMap<String, InputMethodInfo> methodMap = new ArrayMap<>(); final ArrayList<InputMethodInfo> methodList = new ArrayList<>(); final ArrayMap<String, List<InputMethodSubtype>> additionalSubtypeMap = new ArrayMap<>(); AdditionalSubtypeUtils.load(additionalSubtypeMap, userId); Context userAwareContext = mContext.createContextAsUser(UserHandle.of(userId), 0 /* flags */); final int flags = PackageManager.GET_META_DATA | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS | PackageManager.MATCH_DIRECT_BOOT_AUTO; final List<ResolveInfo> services = userAwareContext.getPackageManager().queryIntentServicesAsUser( new Intent(InputMethod.SERVICE_INTERFACE), PackageManager.ResolveInfoFlags.of(flags), userId); for (ResolveInfo ri : services) { final String imeIdResolved = InputMethodInfo.computeId(ri); if (imeId.equals(imeIdResolved)) { try { return new InputMethodInfo( userAwareContext, ri, additionalSubtypeMap.get(imeId)); } catch (Exception e) { Slog.wtf(TAG, "Unable to load input method " + imeId, e); } } } // we didn't find the InputMethodInfo for imeId. This shouldn't happen. Slog.e(TAG, "Error while locating input method info for imeId: " + imeId); return null; queryInputMethodServicesInternal(mContext, userId, additionalSubtypeMap, methodMap, methodList, DirectBootAwareness.AUTO); InputMethodSettings settings = new InputMethodSettings(mContext, methodMap, userId, true /* copyOnWrite */); return methodMap.get(settings.getSelectedInputMethod()); } private ArrayMap<String, InputMethodInfo> queryMethodMapForUser(@UserIdInt int userId) { final ArrayMap<String, InputMethodInfo> methodMap = new ArrayMap<>(); final ArrayList<InputMethodInfo> methodList = new ArrayList<>(); Loading services/core/java/com/android/server/inputmethod/InputMethodUtils.java +0 −10 Original line number Diff line number Diff line Loading @@ -756,16 +756,6 @@ final class InputMethodUtils { return imi; } @Nullable String getSelectedInputMethodForUser(@UserIdInt int userId) { final String imi = getStringForUser(Settings.Secure.DEFAULT_INPUT_METHOD, null, userId); if (DEBUG) { Slog.d(TAG, "getSelectedInputMethodForUserStr: " + imi); } return imi; } void putDefaultVoiceInputMethod(String imeId) { if (DEBUG) { Slog.d(TAG, "putDefaultVoiceInputMethodStr: " + imeId + ", " + mCurrentUserId); Loading Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +10 −36 Original line number Diff line number Diff line Loading @@ -5442,47 +5442,21 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub */ @GuardedBy("ImfLock.class") private InputMethodInfo queryDefaultInputMethodForUserIdLocked(@UserIdInt int userId) { final String imeId = mSettings.getSelectedInputMethodForUser(userId); if (TextUtils.isEmpty(imeId)) { Slog.e(TAG, "No default input method found for userId " + userId); return null; } InputMethodInfo curInputMethodInfo; if (userId == mSettings.getCurrentUserId() && (curInputMethodInfo = mMethodMap.get(imeId)) != null) { // clone the InputMethodInfo before returning. return new InputMethodInfo(curInputMethodInfo); if (userId == mSettings.getCurrentUserId()) { return mMethodMap.get(mSettings.getSelectedInputMethod()); } final ArrayMap<String, InputMethodInfo> methodMap = new ArrayMap<>(); final ArrayList<InputMethodInfo> methodList = new ArrayList<>(); final ArrayMap<String, List<InputMethodSubtype>> additionalSubtypeMap = new ArrayMap<>(); AdditionalSubtypeUtils.load(additionalSubtypeMap, userId); Context userAwareContext = mContext.createContextAsUser(UserHandle.of(userId), 0 /* flags */); final int flags = PackageManager.GET_META_DATA | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS | PackageManager.MATCH_DIRECT_BOOT_AUTO; final List<ResolveInfo> services = userAwareContext.getPackageManager().queryIntentServicesAsUser( new Intent(InputMethod.SERVICE_INTERFACE), PackageManager.ResolveInfoFlags.of(flags), userId); for (ResolveInfo ri : services) { final String imeIdResolved = InputMethodInfo.computeId(ri); if (imeId.equals(imeIdResolved)) { try { return new InputMethodInfo( userAwareContext, ri, additionalSubtypeMap.get(imeId)); } catch (Exception e) { Slog.wtf(TAG, "Unable to load input method " + imeId, e); } } } // we didn't find the InputMethodInfo for imeId. This shouldn't happen. Slog.e(TAG, "Error while locating input method info for imeId: " + imeId); return null; queryInputMethodServicesInternal(mContext, userId, additionalSubtypeMap, methodMap, methodList, DirectBootAwareness.AUTO); InputMethodSettings settings = new InputMethodSettings(mContext, methodMap, userId, true /* copyOnWrite */); return methodMap.get(settings.getSelectedInputMethod()); } private ArrayMap<String, InputMethodInfo> queryMethodMapForUser(@UserIdInt int userId) { final ArrayMap<String, InputMethodInfo> methodMap = new ArrayMap<>(); final ArrayList<InputMethodInfo> methodList = new ArrayList<>(); Loading
services/core/java/com/android/server/inputmethod/InputMethodUtils.java +0 −10 Original line number Diff line number Diff line Loading @@ -756,16 +756,6 @@ final class InputMethodUtils { return imi; } @Nullable String getSelectedInputMethodForUser(@UserIdInt int userId) { final String imi = getStringForUser(Settings.Secure.DEFAULT_INPUT_METHOD, null, userId); if (DEBUG) { Slog.d(TAG, "getSelectedInputMethodForUserStr: " + imi); } return imi; } void putDefaultVoiceInputMethod(String imeId) { if (DEBUG) { Slog.d(TAG, "putDefaultVoiceInputMethodStr: " + imeId + ", " + mCurrentUserId); Loading