am 322366d0: am 9493affc: am 3c4e8cb6: Call loadKeyboard later if it can\'t be called right away

* commit '322366d07ec2431ffc78767c37e58fd7c4a8aea3':
  Call loadKeyboard later if it can't be called right away
main
Jean Chalard 2013-10-09 21:26:16 -07:00 committed by Android Git Automerger
commit cc3bdb5901
2 changed files with 15 additions and 6 deletions

View File

@ -178,8 +178,6 @@ public final class KeyboardState {
if (!state.mIsAlphabetShiftLocked) { if (!state.mIsAlphabetShiftLocked) {
setShifted(state.mShiftMode); setShifted(state.mShiftMode);
} }
// TODO: is this the right place to do this? Should we do this in setShift* instead?
mSwitchActions.requestUpdatingShiftState();
} else { } else {
mPrevMainKeyboardWasShiftLocked = state.mIsAlphabetShiftLocked; mPrevMainKeyboardWasShiftLocked = state.mIsAlphabetShiftLocked;
} }

View File

@ -904,12 +904,17 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Sometimes, while rotating, for some reason the framework tells the app we are not // Sometimes, while rotating, for some reason the framework tells the app we are not
// connected to it and that means we can't refresh the cache. In this case, schedule a // connected to it and that means we can't refresh the cache. In this case, schedule a
// refresh later. // refresh later.
final boolean canReachInputConnection;
if (!mConnection.resetCachesUponCursorMoveAndReturnSuccess(editorInfo.initialSelStart, if (!mConnection.resetCachesUponCursorMoveAndReturnSuccess(editorInfo.initialSelStart,
false /* shouldFinishComposition */)) { false /* shouldFinishComposition */)) {
// We try resetting the caches up to 5 times before giving up. // We try resetting the caches up to 5 times before giving up.
mHandler.postResetCaches(isDifferentTextField, 5 /* remainingTries */); mHandler.postResetCaches(isDifferentTextField, 5 /* remainingTries */);
canReachInputConnection = false;
} else { } else {
if (isDifferentTextField) mHandler.postResumeSuggestions(); if (isDifferentTextField) {
mHandler.postResumeSuggestions();
}
canReachInputConnection = true;
} }
if (isDifferentTextField) { if (isDifferentTextField) {
@ -921,7 +926,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
suggest.setAutoCorrectionThreshold(currentSettingsValues.mAutoCorrectionThreshold); suggest.setAutoCorrectionThreshold(currentSettingsValues.mAutoCorrectionThreshold);
} }
if (canReachInputConnection) {
// If we can't reach the input connection, we don't want to call loadKeyboard yet.
// It will be done in #retryResetCaches.
switcher.loadKeyboard(editorInfo, currentSettingsValues); switcher.loadKeyboard(editorInfo, currentSettingsValues);
}
} else if (restarting) { } else if (restarting) {
// TODO: Come up with a more comprehensive way to reset the keyboard layout when // TODO: Come up with a more comprehensive way to reset the keyboard layout when
// a keyboard layout set doesn't get reloaded in this method. // a keyboard layout set doesn't get reloaded in this method.
@ -2955,11 +2964,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (!mConnection.resetCachesUponCursorMoveAndReturnSuccess(mLastSelectionStart, false)) { if (!mConnection.resetCachesUponCursorMoveAndReturnSuccess(mLastSelectionStart, false)) {
if (0 < remainingTries) { if (0 < remainingTries) {
mHandler.postResetCaches(tryResumeSuggestions, remainingTries - 1); mHandler.postResetCaches(tryResumeSuggestions, remainingTries - 1);
}
return; return;
} }
// If remainingTries is 0, we should stop waiting for new tries, but it's still
// better to load the keyboard (less things will be broken).
}
tryFixLyingCursorPosition(); tryFixLyingCursorPosition();
mKeyboardSwitcher.updateShiftState(); mKeyboardSwitcher.loadKeyboard(getCurrentInputEditorInfo(), mSettings.getCurrent());
if (tryResumeSuggestions) mHandler.postResumeSuggestions(); if (tryResumeSuggestions) mHandler.postResumeSuggestions();
} }