Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee36cf91 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Accept List<> instead of ArrayList<> around InputMethodListBuilder

InputMethodListBuilder can actually take

  List<InputMethodInfo>

instead of

  ArrayList<InputMethodInfo>,

and such a change will help us merge the following fields

  InputMethodManagerService#mMethodList
  InputMethodManagerService#mMethodMap

into

  InputMethodManagerService#mSettings

in a subsequent CL.

There must be no observable behavior change.

Bug: 309837937
Bug: 309870347
Test: presubmit
Change-Id: Ie81ad03693c91d8f39167c0711649b5f2448ceb9
parent 563721fd
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ final class InputMethodInfoUtils {
    private static final String TAG = "InputMethodInfoUtils";

    /**
     * Used in {@link #getFallbackLocaleForDefaultIme(ArrayList, Context)} to find the fallback IMEs
     * Used in {@link #getFallbackLocaleForDefaultIme(List, Context)} to find the fallback IMEs
     * that are mainly used until the system becomes ready. Note that {@link Locale} in this array
     * is checked with {@link Locale#equals(Object)}, which means that {@code Locale.ENGLISH}
     * doesn't automatically match {@code Locale("en", "IN")}.
@@ -64,7 +64,7 @@ final class InputMethodInfoUtils {
        @NonNull
        private final LinkedHashSet<InputMethodInfo> mInputMethodSet = new LinkedHashSet<>();

        InputMethodListBuilder fillImes(ArrayList<InputMethodInfo> imis, Context context,
        InputMethodListBuilder fillImes(List<InputMethodInfo> imis, Context context,
                boolean checkDefaultAttribute, @Nullable Locale locale, boolean checkCountry,
                String requiredSubtypeMode) {
            for (int i = 0; i < imis.size(); ++i) {
@@ -77,7 +77,7 @@ final class InputMethodInfoUtils {
            return this;
        }

        InputMethodListBuilder fillAuxiliaryImes(ArrayList<InputMethodInfo> imis, Context context) {
        InputMethodListBuilder fillAuxiliaryImes(List<InputMethodInfo> imis, Context context) {
            // If one or more auxiliary input methods are available, OK to stop populating the list.
            for (final InputMethodInfo imi : mInputMethodSet) {
                if (imi.isAuxiliaryIme()) {
@@ -118,7 +118,7 @@ final class InputMethodInfoUtils {
    }

    private static InputMethodListBuilder getMinimumKeyboardSetWithSystemLocale(
            ArrayList<InputMethodInfo> imis, Context context, @Nullable Locale systemLocale,
            List<InputMethodInfo> imis, Context context, @Nullable Locale systemLocale,
            @Nullable Locale fallbackLocale) {
        // Once the system becomes ready, we pick up at least one keyboard in the following order.
        // Secondary users fall into this category in general.
@@ -167,7 +167,7 @@ final class InputMethodInfoUtils {
    }

    static ArrayList<InputMethodInfo> getDefaultEnabledImes(
            Context context, ArrayList<InputMethodInfo> imis, boolean onlyMinimum) {
            Context context, List<InputMethodInfo> imis, boolean onlyMinimum) {
        final Locale fallbackLocale = getFallbackLocaleForDefaultIme(imis, context);
        // We will primarily rely on the system locale, but also keep relying on the fallback locale
        // as a last resort.
@@ -186,7 +186,7 @@ final class InputMethodInfoUtils {
    }

    static ArrayList<InputMethodInfo> getDefaultEnabledImes(
            Context context, ArrayList<InputMethodInfo> imis) {
            Context context, List<InputMethodInfo> imis) {
        return getDefaultEnabledImes(context, imis, false /* onlyMinimum */);
    }

@@ -283,7 +283,7 @@ final class InputMethodInfoUtils {
    }

    @Nullable
    private static Locale getFallbackLocaleForDefaultIme(ArrayList<InputMethodInfo> imis,
    private static Locale getFallbackLocaleForDefaultIme(List<InputMethodInfo> imis,
            Context context) {
        // At first, find the fallback locale from the IMEs that are declared as "default" in the
        // current locale.  Note that IME developers can declare an IME as "default" only for