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

Commit 455c2204 authored by Priyanka Advani's avatar Priyanka Advani Committed by Android (Google) Code Review
Browse files

Revert "Fix VDM IME handling:"

This reverts commit d1a6be1b.

Reason for revert: Potential culprit for b/323335053. Will be running through ABTD for verification and before submitting the revert.

Change-Id: I10179118a6254451bdfd296357e094da9274fb87
parent d1a6be1b
Loading
Loading
Loading
Loading
+1 −29
Original line number Diff line number Diff line
@@ -3184,24 +3184,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                }
            }
        }

        if (mDeviceIdToShowIme == DEVICE_ID_DEFAULT) {
            String ime = SecureSettingsWrapper.getString(
                    Settings.Secure.DEFAULT_INPUT_METHOD, null, mSettings.getUserId());
            String defaultDeviceIme = SecureSettingsWrapper.getString(
                    Settings.Secure.DEFAULT_DEVICE_INPUT_METHOD, null, mSettings.getUserId());
            if (defaultDeviceIme != null && !Objects.equals(ime, defaultDeviceIme)) {
                if (DEBUG) {
                    Slog.v(TAG, "Current input method " + ime + " differs from the stored default"
                            + " device input method for user " + mSettings.getUserId()
                            + " - restoring " + defaultDeviceIme);
                }
                SecureSettingsWrapper.putString(
                        Settings.Secure.DEFAULT_INPUT_METHOD, defaultDeviceIme,
                        mSettings.getUserId());
            }
        }

        // We are assuming that whoever is changing DEFAULT_INPUT_METHOD and
        // ENABLED_INPUT_METHODS is taking care of keeping them correctly in
        // sync, so we will never have a DEFAULT_INPUT_METHOD that is not
@@ -5381,11 +5363,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub

        if (!setSubtypeOnly) {
            // Set InputMethod here
            final String imeId = imi != null ? imi.getId() : "";
            mSettings.putSelectedInputMethod(imeId);
            if (mDeviceIdToShowIme == DEVICE_ID_DEFAULT) {
                mSettings.putSelectedDefaultDeviceInputMethod(imeId);
            }
            mSettings.putSelectedInputMethod(imi != null ? imi.getId() : "");
        }
    }

@@ -5528,9 +5506,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
            return false; // IME is not found or not enabled.
        }
        settings.putSelectedInputMethod(imeId);
        if (mDeviceIdToShowIme == DEVICE_ID_DEFAULT) {
            settings.putSelectedDefaultDeviceInputMethod(imeId);
        }
        settings.putSelectedSubtype(NOT_A_SUBTYPE_ID);
        return true;
    }
@@ -6566,9 +6541,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub

                        // Reset selected IME.
                        settings.putSelectedInputMethod(nextIme);
                        if (mDeviceIdToShowIme == DEVICE_ID_DEFAULT) {
                            settings.putSelectedDefaultDeviceInputMethod(nextIme);
                        }
                        settings.putSelectedSubtype(NOT_A_SUBTYPE_ID);
                    }
                    out.println("Reset current and enabled IMEs for user #" + userId);
+7 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.internal.annotations.VisibleForTesting;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;

/**
@@ -87,6 +88,12 @@ final class InputMethodSettings {
        mMethodMap = methodMap;
        mMethodList = methodMap.values();
        mUserId = userId;
        String ime = getSelectedInputMethod();
        String defaultDeviceIme = getSelectedDefaultDeviceInputMethod();
        if (defaultDeviceIme != null && !Objects.equals(ime, defaultDeviceIme)) {
            putSelectedInputMethod(defaultDeviceIme);
            putSelectedDefaultDeviceInputMethod(null);
        }
    }

    @AnyThread