aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java31
1 files changed, 10 insertions, 21 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index db8f269eb..10a6e9544 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -741,6 +741,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// switcher.loadKeyboard; in apps like Talk, we come here when the text is sent and the
// field gets emptied and we need to re-evaluate the shift state, but not the whole layout
// which would be disruptive.
+ // Space state must be updated before calling updateShiftState
mKeyboardSwitcher.updateShiftState();
mHandler.cancelUpdateSuggestionStrip();
@@ -1100,25 +1101,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final EditorInfo ei = getCurrentInputEditorInfo();
if (ei == null) return Constants.TextUtils.CAP_MODE_OFF;
-
final int inputType = ei.inputType;
- if ((inputType & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS) != 0) {
- return TextUtils.CAP_MODE_CHARACTERS;
- }
-
- final boolean noNeedToCheckCapsMode = (inputType & (InputType.TYPE_TEXT_FLAG_CAP_SENTENCES
- | InputType.TYPE_TEXT_FLAG_CAP_WORDS)) == 0;
- if (noNeedToCheckCapsMode) return Constants.TextUtils.CAP_MODE_OFF;
-
- // Avoid making heavy round-trip IPC calls of {@link InputConnection#getCursorCapsMode}
- // unless needed.
- if (mWordComposer.isComposingWord()) return Constants.TextUtils.CAP_MODE_OFF;
-
- // TODO: This blocking IPC call is heavy. Consider doing this without using IPC calls.
- // Note: getCursorCapsMode() returns the current capitalization mode that is any
- // combination of CAP_MODE_CHARACTERS, CAP_MODE_WORDS, and CAP_MODE_SENTENCES. 0 means none
- // of them.
- return mConnection.getCursorCapsMode(inputType, mSubtypeSwitcher.getCurrentSubtypeLocale());
+ // Warning: this depends on mSpaceState, which may not be the most current value. If
+ // mSpaceState gets updated later, whoever called this may need to be told about it.
+ return mConnection.getCursorCapsMode(inputType, mSubtypeSwitcher.getCurrentSubtypeLocale(),
+ SPACE_STATE_PHANTOM == mSpaceState);
}
// Factor in auto-caps and manual caps and compute the current caps mode.
@@ -1391,9 +1378,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
mConnection.commitText(text, 1);
mConnection.endBatchEdit();
+ // Space state must be updated before calling updateShiftState
+ mSpaceState = SPACE_STATE_NONE;
mKeyboardSwitcher.updateShiftState();
mKeyboardSwitcher.onCodeInput(Keyboard.CODE_OUTPUT_TEXT);
- mSpaceState = SPACE_STATE_NONE;
mEnteredText = text;
}
@@ -1509,8 +1497,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mConnection.setComposingText(batchInputText, 1);
mExpectingUpdateSelection = true;
mConnection.endBatchEdit();
- mKeyboardSwitcher.updateShiftState();
+ // Space state must be updated before calling updateShiftState
mSpaceState = SPACE_STATE_PHANTOM;
+ mKeyboardSwitcher.updateShiftState();
}
private CharSequence specificTldProcessingOnTextInput(final CharSequence text) {
@@ -2019,8 +2008,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mConnection.endBatchEdit();
// Don't allow cancellation of manual pick
mLastComposedWord.deactivate();
+ // Space state must be updated before calling updateShiftState
mSpaceState = SPACE_STATE_PHANTOM;
- // TODO: is this necessary?
mKeyboardSwitcher.updateShiftState();
// We should show the "Touch again to save" hint if the user pressed the first entry