diff options
Diffstat (limited to 'java/src')
4 files changed, 22 insertions, 13 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java index 4967a5e80..cb80d052e 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java @@ -149,7 +149,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions, if (mainKeyboardId.isPhoneKeyboard()) { mState.setSymbolsKeyboard(); } - updateShiftState(); } public void saveKeyboardState() { diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardShiftState.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardShiftState.java index 11fb91a8c..4608e22a5 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardShiftState.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardShiftState.java @@ -73,12 +73,7 @@ public class KeyboardShiftState { break; } } else { - switch (oldState) { - case SHIFT_LOCKED: - case SHIFT_LOCK_SHIFTED: - mState = NORMAL; - break; - } + mState = NORMAL; } if (DEBUG) Log.d(TAG, "setShiftLocked(" + newShiftLockState + "): " + toString(oldState) diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java index af16e4907..babf600a6 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java @@ -87,6 +87,16 @@ public class KeyboardState { public boolean mIsAlphabetMode; public boolean mIsShiftLocked; public boolean mIsShifted; + + public String toString() { + if (!mIsValid) return "INVALID"; + if (mIsAlphabetMode) { + if (mIsShiftLocked) return "ALPHABET_SHIFT_LOCKED"; + return mIsShifted ? "ALPHABET_SHIFTED" : "ALPHABET"; + } else { + return mIsShifted ? "SYMBOLS_SHIFTED" : "SYMBOLS"; + } + } } public KeyboardState(SwitchActions switchActions) { @@ -95,7 +105,7 @@ public class KeyboardState { public void onLoadKeyboard(String layoutSwitchBackSymbols) { if (DEBUG_EVENT) { - Log.d(TAG, "onLoadKeyboard"); + Log.d(TAG, "onLoadKeyboard: " + this); } mLayoutSwitchBackSymbols = layoutSwitchBackSymbols; // Reset alphabet shift state. @@ -120,17 +130,14 @@ public class KeyboardState { } state.mIsValid = true; if (DEBUG_EVENT) { - Log.d(TAG, "onSaveKeyboardState: alphabet=" + state.mIsAlphabetMode - + " shiftLocked=" + state.mIsShiftLocked + " shift=" + state.mIsShifted); + Log.d(TAG, "onSaveKeyboardState: saved=" + state + " " + this); } } private void onRestoreKeyboardState() { final SavedKeyboardState state = mSavedKeyboardState; if (DEBUG_EVENT) { - Log.d(TAG, "onRestoreKeyboardState: valid=" + state.mIsValid - + " alphabet=" + state.mIsAlphabetMode - + " shiftLocked=" + state.mIsShiftLocked + " shift=" + state.mIsShifted); + Log.d(TAG, "onRestoreKeyboardState: saved=" + state + " " + this); } if (!state.mIsValid || state.mIsAlphabetMode) { setAlphabetKeyboard(); diff --git a/java/src/com/android/inputmethod/latin/AutoCorrection.java b/java/src/com/android/inputmethod/latin/AutoCorrection.java index e5eb15938..bcb78919d 100644 --- a/java/src/com/android/inputmethod/latin/AutoCorrection.java +++ b/java/src/com/android/inputmethod/latin/AutoCorrection.java @@ -74,6 +74,14 @@ public class AutoCorrection { for (final String key : dictionaries.keySet()) { if (key.equals(Suggest.DICT_KEY_WHITELIST)) continue; final Dictionary dictionary = dictionaries.get(key); + // It's unclear how realistically 'dictionary' can be null, but the monkey is somehow + // managing to get null in here. Presumably the language is changing to a language with + // no main dictionary and the monkey manages to type a whole word before the thread + // that reads the dictionary is started or something? + // Ideally the passed map would come out of a {@link java.util.concurrent.Future} and + // would be immutable once it's finished initializing, but concretely a null test is + // probably good enough for the time being. + if (null == dictionary) continue; if (dictionary.isValidWord(word) || (ignoreCase && dictionary.isValidWord(lowerCasedWord))) { return true; |