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

Commit f6239727 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Simplify IMMS#updateInputMethodsFromSettingsLocked() a bit" into main

parents e10c3b76 4714b33b
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -2973,10 +2973,11 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.

    @GuardedBy("ImfLock.class")
    void updateInputMethodsFromSettingsLocked(boolean enabledMayChange) {
        final InputMethodSettings settings = InputMethodSettingsRepository.get(mCurrentUserId);
        final int userId = mCurrentUserId;
        final InputMethodSettings settings = InputMethodSettingsRepository.get(userId);
        if (enabledMayChange) {
            final PackageManager userAwarePackageManager = getPackageManagerForUser(mContext,
                    settings.getUserId());
                    userId);

            List<InputMethodInfo> enabled = settings.getEnabledInputMethodList();
            for (int i = 0; i < enabled.size(); i++) {
@@ -3005,20 +3006,19 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.

        if (mDeviceIdToShowIme == DEVICE_ID_DEFAULT) {
            String ime = SecureSettingsWrapper.getString(
                    Settings.Secure.DEFAULT_INPUT_METHOD, null, settings.getUserId());
                    Settings.Secure.DEFAULT_INPUT_METHOD, null, userId);
            String defaultDeviceIme = SecureSettingsWrapper.getString(
                    Settings.Secure.DEFAULT_DEVICE_INPUT_METHOD, null, settings.getUserId());
                    Settings.Secure.DEFAULT_DEVICE_INPUT_METHOD, null, userId);
            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 " + settings.getUserId()
                            + " device input method for user " + userId
                            + " - restoring " + defaultDeviceIme);
                }
                SecureSettingsWrapper.putString(
                        Settings.Secure.DEFAULT_INPUT_METHOD, defaultDeviceIme,
                        settings.getUserId());
                        Settings.Secure.DEFAULT_INPUT_METHOD, defaultDeviceIme, userId);
                SecureSettingsWrapper.putString(
                        Settings.Secure.DEFAULT_DEVICE_INPUT_METHOD, null, settings.getUserId());
                        Settings.Secure.DEFAULT_DEVICE_INPUT_METHOD, null, userId);
            }
        }

@@ -3044,18 +3044,18 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        }

        // TODO: Instantiate mSwitchingController for each user.
        if (settings.getUserId() == mSwitchingController.getUserId()) {
        if (userId == mSwitchingController.getUserId()) {
            mSwitchingController.resetCircularListLocked(settings.getMethodMap());
        } else {
            mSwitchingController = InputMethodSubtypeSwitchingController.createInstanceLocked(
                    mContext, settings.getMethodMap(), settings.getUserId());
                    mContext, settings.getMethodMap(), userId);
        }
        // TODO: Instantiate mHardwareKeyboardShortcutController for each user.
        if (settings.getUserId() == mHardwareKeyboardShortcutController.getUserId()) {
        if (userId == mHardwareKeyboardShortcutController.getUserId()) {
            mHardwareKeyboardShortcutController.reset(settings.getMethodMap());
        } else {
            mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController(
                    settings.getMethodMap(), settings.getUserId());
                    settings.getMethodMap(), userId);
        }
        sendOnNavButtonFlagsChangedLocked();
    }