diff --git a/services/core/java/com/android/server/inputmethod/InputMethodSubtypeSwitchingController.java b/services/core/java/com/android/server/inputmethod/InputMethodSubtypeSwitchingController.java index 27c59d462b8e2..88e9976dfd3d7 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodSubtypeSwitchingController.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodSubtypeSwitchingController.java @@ -31,7 +31,6 @@ import com.android.server.inputmethod.InputMethodUtils.InputMethodSettings; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Locale; @@ -184,11 +183,8 @@ final class InputMethodSubtypeSwitchingController { public List getSortedInputMethodAndSubtypeList( boolean includeAuxiliarySubtypes, boolean isScreenLocked) { - final ArrayList imList = new ArrayList<>(); - final HashMap> immis = - mSettings.getExplicitlyOrImplicitlyEnabledInputMethodsAndSubtypeListLocked( - mContext); - if (immis == null || immis.size() == 0) { + final ArrayList imis = mSettings.getEnabledInputMethodListLocked(); + if (imis.isEmpty()) { return Collections.emptyList(); } if (isScreenLocked && includeAuxiliarySubtypes) { @@ -197,11 +193,12 @@ final class InputMethodSubtypeSwitchingController { } includeAuxiliarySubtypes = false; } - for (InputMethodInfo imi : immis.keySet()) { - if (imi == null) { - continue; - } - List explicitlyOrImplicitlyEnabledSubtypeList = immis.get(imi); + final ArrayList imList = new ArrayList<>(); + final int numImes = imis.size(); + for (int i = 0; i < numImes; ++i) { + final InputMethodInfo imi = imis.get(i); + final List explicitlyOrImplicitlyEnabledSubtypeList = + mSettings.getEnabledInputMethodSubtypeListLocked(mContext, imi, true); HashSet enabledSubtypeSet = new HashSet<>(); for (InputMethodSubtype subtype : explicitlyOrImplicitlyEnabledSubtypeList) { enabledSubtypeSet.add(String.valueOf(subtype.hashCode())); diff --git a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java index 154e8b3101284..db6d8260ccd74 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java @@ -1277,17 +1277,6 @@ final class InputMethodUtils { } } - public HashMap> - getExplicitlyOrImplicitlyEnabledInputMethodsAndSubtypeListLocked(Context context) { - HashMap> enabledInputMethodAndSubtypes = - new HashMap<>(); - for (InputMethodInfo imi: getEnabledInputMethodListLocked()) { - enabledInputMethodAndSubtypes.put( - imi, getEnabledInputMethodSubtypeListLocked(context, imi, true)); - } - return enabledInputMethodAndSubtypes; - } - public void dumpLocked(final Printer pw, final String prefix) { pw.println(prefix + "mCurrentUserId=" + mCurrentUserId); pw.println(prefix + "mCurrentProfileIds=" + Arrays.toString(mCurrentProfileIds));