diff options
author | 2011-12-20 14:14:47 +0900 | |
---|---|---|
committer | 2011-12-20 15:31:55 +0900 | |
commit | 752d8cc4fc8550e5ec4eee921f5d611c49f57497 (patch) | |
tree | bd983a764567426e64b2a7362fbfe3f5a15759bd /java/src/com/android/inputmethod/latin/InputAttributes.java | |
parent | 715a203501f748bfa797e5a4232aa884bd372d44 (diff) | |
download | latinime-752d8cc4fc8550e5ec4eee921f5d611c49f57497.tar.gz latinime-752d8cc4fc8550e5ec4eee921f5d611c49f57497.tar.xz latinime-752d8cc4fc8550e5ec4eee921f5d611c49f57497.zip |
Fix a bug with TYPE_TEXT_CLASS
This was introduced by a badly-rebased commit. The culprit was
I103d6851. There was also another bug lurking there introduced
by a previous commit that this fixes.
Bug: 5775347
Change-Id: I133b54a5159e19714f4bcae8ffbb4824cff9f466
Diffstat (limited to 'java/src/com/android/inputmethod/latin/InputAttributes.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/InputAttributes.java | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/latin/InputAttributes.java b/java/src/com/android/inputmethod/latin/InputAttributes.java index 78b2de342..f5cf953c4 100644 --- a/java/src/com/android/inputmethod/latin/InputAttributes.java +++ b/java/src/com/android/inputmethod/latin/InputAttributes.java @@ -34,25 +34,30 @@ public class InputAttributes { final public boolean mApplicationSpecifiedCompletionOn; public InputAttributes(final EditorInfo editorInfo, final boolean isFullscreenMode) { - if (editorInfo == null || editorInfo.inputType == InputType.TYPE_CLASS_TEXT) { - mInsertSpaceOnPickSuggestionManually = false; - mIsSettingsSuggestionStripOn = false; - mInputTypeNoAutoCorrect = false; - mApplicationSpecifiedCompletionOn = false; - } else { - final int inputType = editorInfo.inputType; - if (inputType == InputType.TYPE_NULL) { + final int inputType = null != editorInfo ? editorInfo.inputType : 0; + final int inputClass = inputType & InputType.TYPE_MASK_CLASS; + if (inputClass != InputType.TYPE_CLASS_TEXT) { + // If we are not looking at a TYPE_CLASS_TEXT field, the following strange + // cases may arise, so we do a couple sanity checks for them. If it's a + // TYPE_CLASS_TEXT field, these special cases cannot happen, by construction + // of the flags. + if (null == editorInfo) { + Log.w(TAG, "No editor info for this field. Bug?"); + } else if (InputType.TYPE_NULL == inputType) { // TODO: We should honor TYPE_NULL specification. Log.i(TAG, "InputType.TYPE_NULL is specified"); - } - final int inputClass = inputType & InputType.TYPE_MASK_CLASS; - final int variation = inputType & InputType.TYPE_MASK_VARIATION; - if (inputClass == 0) { + } else if (inputClass == 0) { // TODO: is this check still necessary? Log.w(TAG, String.format("Unexpected input class: inputType=0x%08x" + " imeOptions=0x%08x", inputType, editorInfo.imeOptions)); } + mInsertSpaceOnPickSuggestionManually = false; + mIsSettingsSuggestionStripOn = false; + mInputTypeNoAutoCorrect = false; + mApplicationSpecifiedCompletionOn = false; + } else { + final int variation = inputType & InputType.TYPE_MASK_VARIATION; final boolean flagNoSuggestions = 0 != (inputType & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); final boolean flagMultiLine = |