diff options
| author | 2023-06-01 12:32:12 +0000 | |
|---|---|---|
| committer | 2023-06-01 12:32:12 +0000 | |
| commit | cdfcc2cef954bc37cc1a8f2ede06c9cab0dfb57d (patch) | |
| tree | 43712d435efb1504559b7158e0b428b7419ada3f | |
| parent | 0eae65362d3d8cf6defb60698b704b5a04f8c2fe (diff) | |
Revert "Removed lock of showInputMethodMenu when showing the dialog"
This reverts commit 0eae65362d3d8cf6defb60698b704b5a04f8c2fe.
Reason for revert: causes race condition
Fix: 285036609
Bug: 275450371
Change-Id: Ifa63dfc60179987ffea7cc1154802359553fb928
| -rw-r--r-- | services/core/java/com/android/server/inputmethod/InputMethodMenuController.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java index 44ae454e7ef2..c212e8e3c82c 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java @@ -19,6 +19,7 @@ package com.android.server.inputmethod; import static com.android.server.inputmethod.InputMethodManagerService.DEBUG; import static com.android.server.inputmethod.InputMethodUtils.NOT_A_SUBTYPE_ID; +import android.annotation.Nullable; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; @@ -65,8 +66,8 @@ final class InputMethodMenuController { private boolean mShowImeWithHardKeyboard; @GuardedBy("ImfLock.class") - private final InputMethodDialogWindowContext mDialogWindowContext = - new InputMethodDialogWindowContext(); + @Nullable + private InputMethodDialogWindowContext mDialogWindowContext; InputMethodMenuController(InputMethodManagerService service) { mService = service; @@ -124,11 +125,13 @@ final class InputMethodMenuController { } } + if (mDialogWindowContext == null) { + mDialogWindowContext = new InputMethodDialogWindowContext(); + } final Context dialogWindowContext = mDialogWindowContext.get(displayId); mDialogBuilder = new AlertDialog.Builder(dialogWindowContext); mDialogBuilder.setOnCancelListener(dialog -> hideInputMethodMenu()); - // TODO(b/277061090): refactor UI components should not be created while holding a lock. final Context dialogContext = mDialogBuilder.getContext(); final TypedArray a = dialogContext.obtainStyledAttributes(null, com.android.internal.R.styleable.DialogPreference, @@ -196,11 +199,10 @@ final class InputMethodMenuController { attrs.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; attrs.setTitle("Select input method"); w.setAttributes(attrs); - // TODO(b/277062834) decouple/remove dependency on IMMS mService.updateSystemUiLocked(); mService.sendOnNavButtonFlagsChangedLocked(); + mSwitchingDialog.show(); } - mSwitchingDialog.show(); } private boolean isScreenLocked() { @@ -274,7 +276,6 @@ final class InputMethodMenuController { private final int mTextViewResourceId; private final List<ImeSubtypeListItem> mItemsList; public int mCheckedItem; - private ImeSubtypeListAdapter(Context context, int textViewResourceId, List<ImeSubtypeListItem> itemsList, int checkedItem) { super(context, textViewResourceId, itemsList); |