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

Commit 95ffdae9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Simplify IMMS#setAdditionalInputMethodSubtypes()"

parents 953c2f9b e26fa5ab
Loading
Loading
Loading
Loading
+18 −20
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@ import com.android.internal.inputmethod.UnbindReason;
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.os.TransferPipe;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.ConcurrentUtils;
import com.android.internal.util.DumpUtils;
import com.android.internal.view.IInputMethodManager;
@@ -4190,14 +4191,15 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                Slog.e(TAG, "Failed to get package infos");
                return;
            }
            if (packageInfos != null) {
                final int packageNum = packageInfos.length;
                for (int i = 0; i < packageNum; ++i) {
                    if (packageInfos[i].equals(imi.getPackageName())) {
                        if (subtypes.length > 0) {
                            mAdditionalSubtypeMap.put(imi.getId(), toBeAdded);
                        } else {
            if (ArrayUtils.find(packageInfos,
                    packageInfo -> TextUtils.equals(packageInfo, imi.getPackageName())) == null) {
                return;
            }

            if (toBeAdded.isEmpty()) {
                mAdditionalSubtypeMap.remove(imi.getId());
            } else {
                mAdditionalSubtypeMap.put(imi.getId(), toBeAdded);
            }
            AdditionalSubtypeUtils.save(mAdditionalSubtypeMap, mMethodMap,
                    mSettings.getCurrentUserId());
@@ -4207,10 +4209,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
                        return;
                    }
                }
            }
        }
    }