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

Commit b07ed44c authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Android (Google) Code Review
Browse files

Merge "Accept List<> instead of ArrayList<> around InputMethodListBuilder" into main

parents 6c84ea65 ee36cf91
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -46,7 +46,7 @@ final class InputMethodInfoUtils {
    private static final String TAG = "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
     * 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}
     * is checked with {@link Locale#equals(Object)}, which means that {@code Locale.ENGLISH}
     * doesn't automatically match {@code Locale("en", "IN")}.
     * doesn't automatically match {@code Locale("en", "IN")}.
@@ -64,7 +64,7 @@ final class InputMethodInfoUtils {
        @NonNull
        @NonNull
        private final LinkedHashSet<InputMethodInfo> mInputMethodSet = new LinkedHashSet<>();
        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,
                boolean checkDefaultAttribute, @Nullable Locale locale, boolean checkCountry,
                String requiredSubtypeMode) {
                String requiredSubtypeMode) {
            for (int i = 0; i < imis.size(); ++i) {
            for (int i = 0; i < imis.size(); ++i) {
@@ -77,7 +77,7 @@ final class InputMethodInfoUtils {
            return this;
            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.
            // If one or more auxiliary input methods are available, OK to stop populating the list.
            for (final InputMethodInfo imi : mInputMethodSet) {
            for (final InputMethodInfo imi : mInputMethodSet) {
                if (imi.isAuxiliaryIme()) {
                if (imi.isAuxiliaryIme()) {
@@ -118,7 +118,7 @@ final class InputMethodInfoUtils {
    }
    }


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


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


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


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


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