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

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

Merge IMMS#mMethod{List,Map} into IMMS#mSettings

With this CL the following fields

  InputMethodManagerService#mMethodList
  InputMethodManagerService#mMethodMap

will be effectively merged into

  InputMethodManagerService#mSettings

as immutable fields so that relevant data objects are always
consistent with each other.

There must be no observable behavior change.

Bug: 309837937
Fix: 309870347
Test: atest CtsInputMethodTestCases
Test: atest FrameworksServicesTests:InputMethodSettingsTest
Test: atest FrameworksServicesTests:InputMethodManagerServiceTests
Test: atest FrameworksInputMethodSystemServerTests
Change-Id: I512519ed83b28adb2878945bc3e6eaff9ba29f5e
parent 6d93e4f3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ final class AdditionalSubtypeUtils {
     * @param userId      The user ID to be associated with.
     */
    static void save(ArrayMap<String, List<InputMethodSubtype>> allSubtypes,
            ArrayMap<String, InputMethodInfo> methodMap, @UserIdInt int userId) {
            InputMethodMap methodMap, @UserIdInt int userId) {
        final File inputMethodDir = getInputMethodDir(userId);

        if (allSubtypes.isEmpty()) {
@@ -143,7 +143,7 @@ final class AdditionalSubtypeUtils {

    @VisibleForTesting
    static void saveToFile(ArrayMap<String, List<InputMethodSubtype>> allSubtypes,
            ArrayMap<String, InputMethodInfo> methodMap, AtomicFile subtypesFile) {
            InputMethodMap methodMap, AtomicFile subtypesFile) {
        // Safety net for the case that this function is called before methodMap is set.
        final boolean isSetMethodMap = methodMap != null && methodMap.size() > 0;
        FileOutputStream fos = null;
+3 −5
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.annotation.AnyThread;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.util.ArrayMap;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;

@@ -44,16 +43,15 @@ final class HardwareKeyboardShortcutController {
        return mUserId;
    }

    HardwareKeyboardShortcutController(
            @NonNull ArrayMap<String, InputMethodInfo> methodMap, @UserIdInt int userId) {
    HardwareKeyboardShortcutController(@NonNull InputMethodMap methodMap, @UserIdInt int userId) {
        mUserId = userId;
        reset(methodMap);
    }

    @GuardedBy("ImfLock.class")
    void reset(@NonNull ArrayMap<String, InputMethodInfo> methodMap) {
    void reset(@NonNull InputMethodMap methodMap) {
        mSubtypeHandles.clear();
        final InputMethodSettings settings = new InputMethodSettings(methodMap, mUserId);
        final InputMethodSettings settings = InputMethodSettings.create(methodMap, mUserId);
        final List<InputMethodInfo> inputMethods = settings.getEnabledInputMethodListLocked();
        for (int i = 0; i < inputMethods.size(); ++i) {
            final InputMethodInfo imi = inputMethods.get(i);
+1 −2
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Slog;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
@@ -204,7 +203,7 @@ final class InputMethodInfoUtils {
     */
    @Nullable
    static InputMethodInfo chooseSystemVoiceIme(
            @NonNull ArrayMap<String, InputMethodInfo> methodMap,
            @NonNull InputMethodMap methodMap,
            @Nullable String systemSpeechRecognizerPackageName,
            @Nullable String currentDefaultVoiceImeId) {
        if (TextUtils.isEmpty(systemSpeechRecognizerPackageName)) {
Loading