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

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

Merge "Stop pooling TextUtils.SimpleStringSplitter in InputMethodSettings" into main

parents 4b0ae72e b29d8357
Loading
Loading
Loading
Loading
+14 −16
Original line number Diff line number Diff line
@@ -209,12 +209,6 @@ final class InputMethodUtils {
     */
    @UserHandleAware
    public static class InputMethodSettings {
        private final TextUtils.SimpleStringSplitter mInputMethodSplitter =
                new TextUtils.SimpleStringSplitter(INPUT_METHOD_SEPARATOR);

        private final TextUtils.SimpleStringSplitter mSubtypeSplitter =
                new TextUtils.SimpleStringSplitter(INPUT_METHOD_SUBTYPE_SEPARATOR);

        @NonNull
        private Context mUserAwareContext;
        private final ArrayMap<String, InputMethodInfo> mMethodMap;
@@ -388,8 +382,8 @@ final class InputMethodUtils {

        List<Pair<String, ArrayList<String>>> getEnabledInputMethodsAndSubtypeListLocked() {
            return buildInputMethodsAndSubtypeList(getEnabledInputMethodsStr(),
                    mInputMethodSplitter,
                    mSubtypeSplitter);
                    new TextUtils.SimpleStringSplitter(INPUT_METHOD_SEPARATOR),
                    new TextUtils.SimpleStringSplitter(INPUT_METHOD_SUBTYPE_SEPARATOR));
        }

        List<String> getEnabledInputMethodNames() {
@@ -660,16 +654,20 @@ final class InputMethodUtils {
            if (TextUtils.isEmpty(subtypeHistoryStr)) {
                return imsList;
            }
            mInputMethodSplitter.setString(subtypeHistoryStr);
            while (mInputMethodSplitter.hasNext()) {
                String nextImsStr = mInputMethodSplitter.next();
                mSubtypeSplitter.setString(nextImsStr);
                if (mSubtypeSplitter.hasNext()) {
            final TextUtils.SimpleStringSplitter inputMethodSplitter =
                    new TextUtils.SimpleStringSplitter(INPUT_METHOD_SEPARATOR);
            final TextUtils.SimpleStringSplitter subtypeSplitter =
                    new TextUtils.SimpleStringSplitter(INPUT_METHOD_SUBTYPE_SEPARATOR);
            inputMethodSplitter.setString(subtypeHistoryStr);
            while (inputMethodSplitter.hasNext()) {
                String nextImsStr = inputMethodSplitter.next();
                subtypeSplitter.setString(nextImsStr);
                if (subtypeSplitter.hasNext()) {
                    String subtypeId = NOT_A_SUBTYPE_ID_STR;
                    // The first element is ime id.
                    String imeId = mSubtypeSplitter.next();
                    while (mSubtypeSplitter.hasNext()) {
                        subtypeId = mSubtypeSplitter.next();
                    String imeId = subtypeSplitter.next();
                    while (subtypeSplitter.hasNext()) {
                        subtypeId = subtypeSplitter.next();
                        break;
                    }
                    imsList.add(new Pair<>(imeId, subtypeId));