Merge "Fix IME nav bar button flickers" into udc-qpr-dev
This commit is contained in:
@@ -3043,7 +3043,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
private boolean shouldShowImeSwitcherLocked(
|
private boolean shouldShowImeSwitcherLocked(
|
||||||
@InputMethodService.ImeWindowVisibility int visibility) {
|
@InputMethodService.ImeWindowVisibility int visibility) {
|
||||||
if (!mShowOngoingImeSwitcherForPhones) return false;
|
if (!mShowOngoingImeSwitcherForPhones) return false;
|
||||||
|
// When the IME switcher dialog is shown, the IME switcher button should be hidden.
|
||||||
if (mMenuController.getSwitchingDialogLocked() != null) return false;
|
if (mMenuController.getSwitchingDialogLocked() != null) return false;
|
||||||
|
// When we are switching IMEs, the IME switcher button should be hidden.
|
||||||
|
if (!Objects.equals(getCurIdLocked(), getSelectedMethodIdLocked())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (mWindowManagerInternal.isKeyguardShowingAndNotOccluded()
|
if (mWindowManagerInternal.isKeyguardShowingAndNotOccluded()
|
||||||
&& mWindowManagerInternal.isKeyguardSecure(mSettings.getCurrentUserId())) {
|
&& mWindowManagerInternal.isKeyguardSecure(mSettings.getCurrentUserId())) {
|
||||||
return false;
|
return false;
|
||||||
@@ -3208,7 +3213,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
} else {
|
} else {
|
||||||
vis &= ~InputMethodService.IME_VISIBLE_IMPERCEPTIBLE;
|
vis &= ~InputMethodService.IME_VISIBLE_IMPERCEPTIBLE;
|
||||||
}
|
}
|
||||||
// mImeWindowVis should be updated before calling shouldShowImeSwitcherLocked().
|
if (mMenuController.getSwitchingDialogLocked() != null
|
||||||
|
|| !Objects.equals(getCurIdLocked(), getSelectedMethodIdLocked())) {
|
||||||
|
// When the IME switcher dialog is shown, or we are switching IMEs,
|
||||||
|
// the back button should be in the default state (as if the IME is not shown).
|
||||||
|
backDisposition = InputMethodService.BACK_DISPOSITION_ADJUST_NOTHING;
|
||||||
|
}
|
||||||
final boolean needsToShowImeSwitcher = shouldShowImeSwitcherLocked(vis);
|
final boolean needsToShowImeSwitcher = shouldShowImeSwitcherLocked(vis);
|
||||||
if (mStatusBarManagerInternal != null) {
|
if (mStatusBarManagerInternal != null) {
|
||||||
mStatusBarManagerInternal.setImeWindowStatus(mCurTokenDisplayId,
|
mStatusBarManagerInternal.setImeWindowStatus(mCurTokenDisplayId,
|
||||||
@@ -5775,7 +5785,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
// input target changed, in case seeing the dialog dismiss flickering during
|
// input target changed, in case seeing the dialog dismiss flickering during
|
||||||
// the next focused window starting the input connection.
|
// the next focused window starting the input connection.
|
||||||
if (mLastImeTargetWindow != mCurFocusedWindow) {
|
if (mLastImeTargetWindow != mCurFocusedWindow) {
|
||||||
mMenuController.hideInputMethodMenu();
|
mMenuController.hideInputMethodMenuLocked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,13 +175,13 @@ final class InputMethodMenuController {
|
|||||||
int subtypeId = mSubtypeIds[which];
|
int subtypeId = mSubtypeIds[which];
|
||||||
adapter.mCheckedItem = which;
|
adapter.mCheckedItem = which;
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
hideInputMethodMenu();
|
|
||||||
if (im != null) {
|
if (im != null) {
|
||||||
if (subtypeId < 0 || subtypeId >= im.getSubtypeCount()) {
|
if (subtypeId < 0 || subtypeId >= im.getSubtypeCount()) {
|
||||||
subtypeId = NOT_A_SUBTYPE_ID;
|
subtypeId = NOT_A_SUBTYPE_ID;
|
||||||
}
|
}
|
||||||
mService.setInputMethodLocked(im.getId(), subtypeId);
|
mService.setInputMethodLocked(im.getId(), subtypeId);
|
||||||
}
|
}
|
||||||
|
hideInputMethodMenuLocked();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, choiceListener);
|
mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, choiceListener);
|
||||||
@@ -220,12 +220,18 @@ final class InputMethodMenuController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides the input method switcher menu.
|
||||||
|
*/
|
||||||
void hideInputMethodMenu() {
|
void hideInputMethodMenu() {
|
||||||
synchronized (ImfLock.class) {
|
synchronized (ImfLock.class) {
|
||||||
hideInputMethodMenuLocked();
|
hideInputMethodMenuLocked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides the input method switcher menu, synchronised version of {@link #hideInputMethodMenu}.
|
||||||
|
*/
|
||||||
@GuardedBy("ImfLock.class")
|
@GuardedBy("ImfLock.class")
|
||||||
void hideInputMethodMenuLocked() {
|
void hideInputMethodMenuLocked() {
|
||||||
if (DEBUG) Slog.v(TAG, "Hide switching menu");
|
if (DEBUG) Slog.v(TAG, "Hide switching menu");
|
||||||
|
|||||||
Reference in New Issue
Block a user