Avoid calling switchToLastInputMethod when other IMEs are in effect (DO NOT MERGE)
Bug: 7299050 Change-Id: Ife6721a5fcbc4872bd36ffd8a8b81b04d73aebec
This commit is contained in:
parent
448e732272
commit
792980d4aa
1 changed files with 8 additions and 5 deletions
|
@ -1219,22 +1219,25 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
|||
mConnection.performEditorAction(actionId);
|
||||
}
|
||||
|
||||
// TODO: Revise the language switch key behavior to make it much smarter and more reasonable.
|
||||
private void handleLanguageSwitchKey() {
|
||||
final boolean includesOtherImes = mCurrentSettings.mIncludesOtherImesInLanguageSwitchList;
|
||||
final IBinder token = getWindow().getWindow().getAttributes().token;
|
||||
if (mCurrentSettings.mIncludesOtherImesInLanguageSwitchList) {
|
||||
mImm.switchToNextInputMethod(token, false /* onlyCurrentIme */);
|
||||
return;
|
||||
}
|
||||
if (mShouldSwitchToLastSubtype) {
|
||||
final InputMethodSubtype lastSubtype = mImm.getLastInputMethodSubtype();
|
||||
final boolean lastSubtypeBelongsToThisIme =
|
||||
ImfUtils.checkIfSubtypeBelongsToThisImeAndEnabled(this, lastSubtype);
|
||||
if ((includesOtherImes || lastSubtypeBelongsToThisIme)
|
||||
&& mImm.switchToLastInputMethod(token)) {
|
||||
if (lastSubtypeBelongsToThisIme && mImm.switchToLastInputMethod(token)) {
|
||||
mShouldSwitchToLastSubtype = false;
|
||||
} else {
|
||||
mImm.switchToNextInputMethod(token, !includesOtherImes);
|
||||
mImm.switchToNextInputMethod(token, true /* onlyCurrentIme */);
|
||||
mShouldSwitchToLastSubtype = true;
|
||||
}
|
||||
} else {
|
||||
mImm.switchToNextInputMethod(token, !includesOtherImes);
|
||||
mImm.switchToNextInputMethod(token, true /* onlyCurrentIme */);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue