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

Commit 512c46b8 authored by Felix Stern's avatar Felix Stern Committed by Automerger Merge Worker
Browse files

Merge "Revert "Removed lock of showInputMethodMenu when showing the dialog""...

Merge "Revert "Removed lock of showInputMethodMenu when showing the dialog"" into udc-dev am: f7cbf38e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23481698



Change-Id: Iadb242cdab724db0e55c3dc3a2588168406c0d60
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents feb061e5 f7cbf38e
Loading
Loading
Loading
Loading
+7 −6
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.inputmethod;
import static com.android.server.inputmethod.InputMethodManagerService.DEBUG;
import static com.android.server.inputmethod.InputMethodManagerService.DEBUG;
import static com.android.server.inputmethod.InputMethodUtils.NOT_A_SUBTYPE_ID;
import static com.android.server.inputmethod.InputMethodUtils.NOT_A_SUBTYPE_ID;


import android.annotation.Nullable;
import android.app.AlertDialog;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface;
@@ -65,8 +66,8 @@ final class InputMethodMenuController {
    private boolean mShowImeWithHardKeyboard;
    private boolean mShowImeWithHardKeyboard;


    @GuardedBy("ImfLock.class")
    @GuardedBy("ImfLock.class")
    private final InputMethodDialogWindowContext mDialogWindowContext =
    @Nullable
            new InputMethodDialogWindowContext();
    private InputMethodDialogWindowContext mDialogWindowContext;


    InputMethodMenuController(InputMethodManagerService service) {
    InputMethodMenuController(InputMethodManagerService service) {
        mService = service;
        mService = service;
@@ -124,11 +125,13 @@ final class InputMethodMenuController {
                }
                }
            }
            }


            if (mDialogWindowContext == null) {
                mDialogWindowContext = new InputMethodDialogWindowContext();
            }
            final Context dialogWindowContext = mDialogWindowContext.get(displayId);
            final Context dialogWindowContext = mDialogWindowContext.get(displayId);
            mDialogBuilder = new AlertDialog.Builder(dialogWindowContext);
            mDialogBuilder = new AlertDialog.Builder(dialogWindowContext);
            mDialogBuilder.setOnCancelListener(dialog -> hideInputMethodMenu());
            mDialogBuilder.setOnCancelListener(dialog -> hideInputMethodMenu());


            // TODO(b/277061090): refactor UI components should not be created while holding a lock.
            final Context dialogContext = mDialogBuilder.getContext();
            final Context dialogContext = mDialogBuilder.getContext();
            final TypedArray a = dialogContext.obtainStyledAttributes(null,
            final TypedArray a = dialogContext.obtainStyledAttributes(null,
                    com.android.internal.R.styleable.DialogPreference,
                    com.android.internal.R.styleable.DialogPreference,
@@ -196,12 +199,11 @@ final class InputMethodMenuController {
            attrs.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
            attrs.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
            attrs.setTitle("Select input method");
            attrs.setTitle("Select input method");
            w.setAttributes(attrs);
            w.setAttributes(attrs);
            // TODO(b/277062834) decouple/remove dependency on IMMS
            mService.updateSystemUiLocked();
            mService.updateSystemUiLocked();
            mService.sendOnNavButtonFlagsChangedLocked();
            mService.sendOnNavButtonFlagsChangedLocked();
        }
            mSwitchingDialog.show();
            mSwitchingDialog.show();
        }
        }
    }


    private boolean isScreenLocked() {
    private boolean isScreenLocked() {
        return mWindowManagerInternal.isKeyguardLocked()
        return mWindowManagerInternal.isKeyguardLocked()
@@ -274,7 +276,6 @@ final class InputMethodMenuController {
        private final int mTextViewResourceId;
        private final int mTextViewResourceId;
        private final List<ImeSubtypeListItem> mItemsList;
        private final List<ImeSubtypeListItem> mItemsList;
        public int mCheckedItem;
        public int mCheckedItem;

        private ImeSubtypeListAdapter(Context context, int textViewResourceId,
        private ImeSubtypeListAdapter(Context context, int textViewResourceId,
                List<ImeSubtypeListItem> itemsList, int checkedItem) {
                List<ImeSubtypeListItem> itemsList, int checkedItem) {
            super(context, textViewResourceId, itemsList);
            super(context, textViewResourceId, itemsList);