[IL66] Remove two accesses to KeyboardSwitcher.
Bug: 8636060 Change-Id: I3b144993e2bcd552f9b292b8f057c9db4216125cmain
parent
a91dfff5e5
commit
ab80b41a0d
|
@ -217,10 +217,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
(SuggestedWords) msg.obj, latinIme.mKeyboardSwitcher);
|
(SuggestedWords) msg.obj, latinIme.mKeyboardSwitcher);
|
||||||
break;
|
break;
|
||||||
case MSG_RESET_CACHES:
|
case MSG_RESET_CACHES:
|
||||||
latinIme.mInputLogic.retryResetCaches(latinIme.mSettings.getCurrent(),
|
final SettingsValues settingsValues = latinIme.mSettings.getCurrent();
|
||||||
|
if (latinIme.mInputLogic.retryResetCachesAndReturnSuccess(settingsValues,
|
||||||
msg.arg1 == 1 /* tryResumeSuggestions */,
|
msg.arg1 == 1 /* tryResumeSuggestions */,
|
||||||
msg.arg2 /* remainingTries */,
|
msg.arg2 /* remainingTries */, this /* handler */)) {
|
||||||
latinIme.mKeyboardSwitcher, this);
|
// If we were able to reset the caches, then we can reload the keyboard.
|
||||||
|
// Otherwise, we'll do it when we can.
|
||||||
|
latinIme.mKeyboardSwitcher.loadKeyboard(latinIme.getCurrentInputEditorInfo(),
|
||||||
|
settingsValues);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1257,6 +1262,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
final int keyY = mainKeyboardView.getKeyY(y);
|
final int keyY = mainKeyboardView.getKeyY(y);
|
||||||
mInputLogic.onCodeInput(codePoint, keyX, keyY, mHandler, mKeyboardSwitcher,
|
mInputLogic.onCodeInput(codePoint, keyX, keyY, mHandler, mKeyboardSwitcher,
|
||||||
mSubtypeSwitcher);
|
mSubtypeSwitcher);
|
||||||
|
mKeyboardSwitcher.onCodeInput(codePoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called from PointerTracker through the KeyboardActionListener interface
|
// Called from PointerTracker through the KeyboardActionListener interface
|
||||||
|
|
|
@ -300,7 +300,6 @@ public final class InputLogic {
|
||||||
code, x, y, spaceState, keyboardSwitcher, handler);
|
code, x, y, spaceState, keyboardSwitcher, handler);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
keyboardSwitcher.onCodeInput(code);
|
|
||||||
// Reset after any single keystroke, except shift, capslock, and symbol-shift
|
// Reset after any single keystroke, except shift, capslock, and symbol-shift
|
||||||
if (!didAutoCorrect && code != Constants.CODE_SHIFT
|
if (!didAutoCorrect && code != Constants.CODE_SHIFT
|
||||||
&& code != Constants.CODE_CAPSLOCK
|
&& code != Constants.CODE_CAPSLOCK
|
||||||
|
@ -1699,26 +1698,27 @@ public final class InputLogic {
|
||||||
* @param settingsValues the current values of the settings.
|
* @param settingsValues the current values of the settings.
|
||||||
* @param tryResumeSuggestions Whether we should resume suggestions or not.
|
* @param tryResumeSuggestions Whether we should resume suggestions or not.
|
||||||
* @param remainingTries How many times we may try again before giving up.
|
* @param remainingTries How many times we may try again before giving up.
|
||||||
|
* @return whether true if the caches were successfully reset, false otherwise.
|
||||||
*/
|
*/
|
||||||
// TODO: make this private
|
// TODO: make this private
|
||||||
public void retryResetCaches(final SettingsValues settingsValues,
|
public boolean retryResetCachesAndReturnSuccess(final SettingsValues settingsValues,
|
||||||
final boolean tryResumeSuggestions, final int remainingTries,
|
final boolean tryResumeSuggestions, final int remainingTries,
|
||||||
// TODO: remove these arguments
|
// TODO: remove these arguments
|
||||||
final KeyboardSwitcher keyboardSwitcher, final LatinIME.UIHandler handler) {
|
final LatinIME.UIHandler handler) {
|
||||||
if (!mConnection.resetCachesUponCursorMoveAndReturnSuccess(
|
if (!mConnection.resetCachesUponCursorMoveAndReturnSuccess(
|
||||||
mConnection.getExpectedSelectionStart(), mConnection.getExpectedSelectionEnd(),
|
mConnection.getExpectedSelectionStart(), mConnection.getExpectedSelectionEnd(),
|
||||||
false)) {
|
false)) {
|
||||||
if (0 < remainingTries) {
|
if (0 < remainingTries) {
|
||||||
handler.postResetCaches(tryResumeSuggestions, remainingTries - 1);
|
handler.postResetCaches(tryResumeSuggestions, remainingTries - 1);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
// If remainingTries is 0, we should stop waiting for new tries, but it's still
|
// If remainingTries is 0, we should stop waiting for new tries, however we'll still
|
||||||
// better to load the keyboard (less things will be broken).
|
// return true as we need to perform other tasks (for example, loading the keyboard).
|
||||||
}
|
}
|
||||||
mConnection.tryFixLyingCursorPosition();
|
mConnection.tryFixLyingCursorPosition();
|
||||||
keyboardSwitcher.loadKeyboard(getCurrentInputEditorInfo(), settingsValues);
|
|
||||||
if (tryResumeSuggestions) {
|
if (tryResumeSuggestions) {
|
||||||
handler.postResumeSuggestions();
|
handler.postResumeSuggestions();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue