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

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

Merge "Fix accesses to InputMethodMenuController#mSettings without lock" into main

parents 1aa64758 d2018b52
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -77,13 +77,14 @@ final class InputMethodMenuController {
    void showInputMethodMenu(boolean showAuxSubtypes, int displayId) {
        if (DEBUG) Slog.v(TAG, "Show switching menu. showAuxSubtypes=" + showAuxSubtypes);

        final boolean isScreenLocked = isScreenLocked();

        synchronized (ImfLock.class) {
            final boolean isScreenLocked = mWindowManagerInternal.isKeyguardLocked()
                    && mWindowManagerInternal.isKeyguardSecure(mSettings.getCurrentUserId());
            final String lastInputMethodId = mSettings.getSelectedInputMethod();
        int lastInputMethodSubtypeId = mSettings.getSelectedInputMethodSubtypeId(lastInputMethodId);
            int lastInputMethodSubtypeId =
                    mSettings.getSelectedInputMethodSubtypeId(lastInputMethodId);
            if (DEBUG) Slog.v(TAG, "Current IME: " + lastInputMethodId);

        synchronized (ImfLock.class) {
            final List<ImeSubtypeListItem> imList = mSwitchingController
                    .getSortedInputMethodAndSubtypeListForImeMenuLocked(
                            showAuxSubtypes, isScreenLocked);
@@ -200,12 +201,8 @@ final class InputMethodMenuController {
            mService.updateSystemUiLocked();
            mService.sendOnNavButtonFlagsChangedLocked();
            mSwitchingDialog.show();
        }
    }

    private boolean isScreenLocked() {
        return mWindowManagerInternal.isKeyguardLocked()
                && mWindowManagerInternal.isKeyguardSecure(mSettings.getCurrentUserId());
        }
    }

    void updateKeyboardFromSettingsLocked() {