Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +6 −12 Original line number Diff line number Diff line Loading @@ -619,7 +619,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. case Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD: { if (!mNewInputMethodSwitcherMenuEnabled) { if (userId == mCurrentUserId) { mMenuController.updateKeyboardFromSettingsLocked(); mMenuController.updateKeyboardFromSettingsLocked(userId); } } break; Loading Loading @@ -693,7 +693,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. senderUserId); } } else { mMenuController.hideInputMethodMenu(); mMenuController.hideInputMethodMenu(senderUserId); } } else { Slog.w(TAG, "Unexpected intent " + intent); Loading Loading @@ -1222,12 +1222,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } @GuardedBy("ImfLock.class") @UserIdInt int getCurrentImeUserIdLocked() { return mCurrentUserId; } private final class InkWindowInitializer implements Runnable { public void run() { synchronized (ImfLock.class) { Loading Loading @@ -1826,7 +1820,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. if (mNewInputMethodSwitcherMenuEnabled) { mMenuControllerNew.hide(bindingController.getCurTokenDisplayId(), userId); } else { mMenuController.hideInputMethodMenuLocked(); mMenuController.hideInputMethodMenuLocked(userId); } } } Loading Loading @@ -2860,7 +2854,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. void updateFromSettingsLocked(boolean enabledMayChange, @UserIdInt int userId) { updateInputMethodsFromSettingsLocked(enabledMayChange, userId); if (!mNewInputMethodSwitcherMenuEnabled) { mMenuController.updateKeyboardFromSettingsLocked(); mMenuController.updateKeyboardFromSettingsLocked(userId); } } Loading Loading @@ -5071,7 +5065,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mMenuControllerNew.show(menuItems, selectedIndex, displayId, userId); } else { mMenuController.showInputMethodMenuLocked(showAuxSubtypes, displayId, lastInputMethodId, lastInputMethodSubtypeId, imList); lastInputMethodId, lastInputMethodSubtypeId, imList, userId); } } Loading Loading @@ -5948,7 +5942,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final var bindingController = getInputMethodBindingController(userId); mMenuControllerNew.hide(bindingController.getCurTokenDisplayId(), userId); } else { mMenuController.hideInputMethodMenuLocked(); mMenuController.hideInputMethodMenuLocked(userId); } } } Loading services/core/java/com/android/server/inputmethod/InputMethodMenuController.java +15 −13 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.android.server.inputmethod.InputMethodUtils.NOT_A_SUBTYPE_ID; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; Loading Loading @@ -77,13 +78,12 @@ final class InputMethodMenuController { @GuardedBy("ImfLock.class") void showInputMethodMenuLocked(boolean showAuxSubtypes, int displayId, String preferredInputMethodId, int preferredInputMethodSubtypeId, @NonNull List<ImeSubtypeListItem> imList) { @NonNull List<ImeSubtypeListItem> imList, @UserIdInt int userId) { if (DEBUG) Slog.v(TAG, "Show switching menu. showAuxSubtypes=" + showAuxSubtypes); final int userId = mService.getCurrentImeUserIdLocked(); final var bindingController = mService.getInputMethodBindingController(userId); hideInputMethodMenuLocked(); hideInputMethodMenuLocked(userId); if (preferredInputMethodSubtypeId == NOT_A_SUBTYPE_ID) { final InputMethodSubtype currentSubtype = Loading Loading @@ -131,7 +131,7 @@ final class InputMethodMenuController { } final Context dialogWindowContext = mDialogWindowContext.get(displayId); mDialogBuilder = new AlertDialog.Builder(dialogWindowContext); mDialogBuilder.setOnCancelListener(dialog -> hideInputMethodMenu()); mDialogBuilder.setOnCancelListener(dialog -> hideInputMethodMenu(userId)); final Context dialogContext = mDialogBuilder.getContext(); final TypedArray a = dialogContext.obtainStyledAttributes(null, Loading Loading @@ -162,7 +162,7 @@ final class InputMethodMenuController { isChecked, userId); // Ensure that the input method dialog is dismissed when changing // the hardware keyboard state. hideInputMethodMenu(); hideInputMethodMenu(userId); }); // Fill the list items with onClick listener, which takes care of IME (and subtype) Loading @@ -185,7 +185,7 @@ final class InputMethodMenuController { } mService.setInputMethodLocked(im.getId(), subtypeId, userId); } hideInputMethodMenuLocked(); hideInputMethodMenuLocked(userId); } }; mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, choiceListener); Loading @@ -209,10 +209,10 @@ final class InputMethodMenuController { mSwitchingDialog.show(); } void updateKeyboardFromSettingsLocked() { void updateKeyboardFromSettingsLocked(@UserIdInt int userId) { mShowImeWithHardKeyboard = SecureSettingsWrapper.getBoolean(Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, false, mService.getCurrentImeUserIdLocked()); false, userId); if (mSwitchingDialog != null && mSwitchingDialogTitleView != null && mSwitchingDialog.isShowing()) { final Switch hardKeySwitch = mSwitchingDialogTitleView.findViewById( Loading @@ -223,18 +223,22 @@ final class InputMethodMenuController { /** * Hides the input method switcher menu. * * @param userId user ID for this operation */ void hideInputMethodMenu() { void hideInputMethodMenu(@UserIdInt int userId) { synchronized (ImfLock.class) { hideInputMethodMenuLocked(); hideInputMethodMenuLocked(userId); } } /** * Hides the input method switcher menu, synchronised version of {@link #hideInputMethodMenu}. * * @param userId user ID for this operation */ @GuardedBy("ImfLock.class") void hideInputMethodMenuLocked() { void hideInputMethodMenuLocked(@UserIdInt int userId) { if (DEBUG) Slog.v(TAG, "Hide switching menu"); if (mSwitchingDialog != null) { Loading @@ -242,8 +246,6 @@ final class InputMethodMenuController { mSwitchingDialog = null; mSwitchingDialogTitleView = null; // TODO(b/305849394): Make InputMethodMenuController multi-user aware final int userId = mService.getCurrentImeUserIdLocked(); mService.updateSystemUiLocked(userId); mService.sendOnNavButtonFlagsChangedToAllImesLocked(); mDialogBuilder = null; Loading Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +6 −12 Original line number Diff line number Diff line Loading @@ -619,7 +619,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. case Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD: { if (!mNewInputMethodSwitcherMenuEnabled) { if (userId == mCurrentUserId) { mMenuController.updateKeyboardFromSettingsLocked(); mMenuController.updateKeyboardFromSettingsLocked(userId); } } break; Loading Loading @@ -693,7 +693,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. senderUserId); } } else { mMenuController.hideInputMethodMenu(); mMenuController.hideInputMethodMenu(senderUserId); } } else { Slog.w(TAG, "Unexpected intent " + intent); Loading Loading @@ -1222,12 +1222,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } @GuardedBy("ImfLock.class") @UserIdInt int getCurrentImeUserIdLocked() { return mCurrentUserId; } private final class InkWindowInitializer implements Runnable { public void run() { synchronized (ImfLock.class) { Loading Loading @@ -1826,7 +1820,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. if (mNewInputMethodSwitcherMenuEnabled) { mMenuControllerNew.hide(bindingController.getCurTokenDisplayId(), userId); } else { mMenuController.hideInputMethodMenuLocked(); mMenuController.hideInputMethodMenuLocked(userId); } } } Loading Loading @@ -2860,7 +2854,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. void updateFromSettingsLocked(boolean enabledMayChange, @UserIdInt int userId) { updateInputMethodsFromSettingsLocked(enabledMayChange, userId); if (!mNewInputMethodSwitcherMenuEnabled) { mMenuController.updateKeyboardFromSettingsLocked(); mMenuController.updateKeyboardFromSettingsLocked(userId); } } Loading Loading @@ -5071,7 +5065,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mMenuControllerNew.show(menuItems, selectedIndex, displayId, userId); } else { mMenuController.showInputMethodMenuLocked(showAuxSubtypes, displayId, lastInputMethodId, lastInputMethodSubtypeId, imList); lastInputMethodId, lastInputMethodSubtypeId, imList, userId); } } Loading Loading @@ -5948,7 +5942,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final var bindingController = getInputMethodBindingController(userId); mMenuControllerNew.hide(bindingController.getCurTokenDisplayId(), userId); } else { mMenuController.hideInputMethodMenuLocked(); mMenuController.hideInputMethodMenuLocked(userId); } } } Loading
services/core/java/com/android/server/inputmethod/InputMethodMenuController.java +15 −13 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.android.server.inputmethod.InputMethodUtils.NOT_A_SUBTYPE_ID; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; Loading Loading @@ -77,13 +78,12 @@ final class InputMethodMenuController { @GuardedBy("ImfLock.class") void showInputMethodMenuLocked(boolean showAuxSubtypes, int displayId, String preferredInputMethodId, int preferredInputMethodSubtypeId, @NonNull List<ImeSubtypeListItem> imList) { @NonNull List<ImeSubtypeListItem> imList, @UserIdInt int userId) { if (DEBUG) Slog.v(TAG, "Show switching menu. showAuxSubtypes=" + showAuxSubtypes); final int userId = mService.getCurrentImeUserIdLocked(); final var bindingController = mService.getInputMethodBindingController(userId); hideInputMethodMenuLocked(); hideInputMethodMenuLocked(userId); if (preferredInputMethodSubtypeId == NOT_A_SUBTYPE_ID) { final InputMethodSubtype currentSubtype = Loading Loading @@ -131,7 +131,7 @@ final class InputMethodMenuController { } final Context dialogWindowContext = mDialogWindowContext.get(displayId); mDialogBuilder = new AlertDialog.Builder(dialogWindowContext); mDialogBuilder.setOnCancelListener(dialog -> hideInputMethodMenu()); mDialogBuilder.setOnCancelListener(dialog -> hideInputMethodMenu(userId)); final Context dialogContext = mDialogBuilder.getContext(); final TypedArray a = dialogContext.obtainStyledAttributes(null, Loading Loading @@ -162,7 +162,7 @@ final class InputMethodMenuController { isChecked, userId); // Ensure that the input method dialog is dismissed when changing // the hardware keyboard state. hideInputMethodMenu(); hideInputMethodMenu(userId); }); // Fill the list items with onClick listener, which takes care of IME (and subtype) Loading @@ -185,7 +185,7 @@ final class InputMethodMenuController { } mService.setInputMethodLocked(im.getId(), subtypeId, userId); } hideInputMethodMenuLocked(); hideInputMethodMenuLocked(userId); } }; mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, choiceListener); Loading @@ -209,10 +209,10 @@ final class InputMethodMenuController { mSwitchingDialog.show(); } void updateKeyboardFromSettingsLocked() { void updateKeyboardFromSettingsLocked(@UserIdInt int userId) { mShowImeWithHardKeyboard = SecureSettingsWrapper.getBoolean(Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, false, mService.getCurrentImeUserIdLocked()); false, userId); if (mSwitchingDialog != null && mSwitchingDialogTitleView != null && mSwitchingDialog.isShowing()) { final Switch hardKeySwitch = mSwitchingDialogTitleView.findViewById( Loading @@ -223,18 +223,22 @@ final class InputMethodMenuController { /** * Hides the input method switcher menu. * * @param userId user ID for this operation */ void hideInputMethodMenu() { void hideInputMethodMenu(@UserIdInt int userId) { synchronized (ImfLock.class) { hideInputMethodMenuLocked(); hideInputMethodMenuLocked(userId); } } /** * Hides the input method switcher menu, synchronised version of {@link #hideInputMethodMenu}. * * @param userId user ID for this operation */ @GuardedBy("ImfLock.class") void hideInputMethodMenuLocked() { void hideInputMethodMenuLocked(@UserIdInt int userId) { if (DEBUG) Slog.v(TAG, "Hide switching menu"); if (mSwitchingDialog != null) { Loading @@ -242,8 +246,6 @@ final class InputMethodMenuController { mSwitchingDialog = null; mSwitchingDialogTitleView = null; // TODO(b/305849394): Make InputMethodMenuController multi-user aware final int userId = mService.getCurrentImeUserIdLocked(); mService.updateSystemUiLocked(userId); mService.sendOnNavButtonFlagsChangedToAllImesLocked(); mDialogBuilder = null; Loading