diff options
author | 2013-03-15 19:00:51 +0900 | |
---|---|---|
committer | 2013-03-19 15:40:14 +0900 | |
commit | 0cc0544a2995c7eb54a830ae54db60af89d4073d (patch) | |
tree | 095745e7050c4a8f557f8967217f332874c78f04 /java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerSession.java | |
parent | 5b048292540b6fbbd8929a3622262f352245d464 (diff) | |
download | latinime-0cc0544a2995c7eb54a830ae54db60af89d4073d.tar.gz latinime-0cc0544a2995c7eb54a830ae54db60af89d4073d.tar.xz latinime-0cc0544a2995c7eb54a830ae54db60af89d4073d.zip |
Merge the dictionary pack in Latin IME.
Bug: 8161354
Change-Id: I17c23f56dd3bc2f27726556bf2c5a9d5520bd172
Diffstat (limited to 'java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerSession.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerSession.java | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerSession.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerSession.java index 63f46b79e..9a1114f7f 100644 --- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerSession.java +++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerSession.java @@ -16,6 +16,7 @@ package com.android.inputmethod.latin.spellcheck; +import android.os.Binder; import android.text.TextUtils; import android.util.Log; import android.view.textservice.SentenceSuggestionsInfo; @@ -133,22 +134,27 @@ public final class AndroidSpellCheckerSession extends AndroidWordLevelSpellCheck @Override public SuggestionsInfo[] onGetSuggestionsMultiple(TextInfo[] textInfos, int suggestionsLimit, boolean sequentialWords) { - final int length = textInfos.length; - final SuggestionsInfo[] retval = new SuggestionsInfo[length]; - for (int i = 0; i < length; ++i) { - final String prevWord; - if (sequentialWords && i > 0) { + long ident = Binder.clearCallingIdentity(); + try { + final int length = textInfos.length; + final SuggestionsInfo[] retval = new SuggestionsInfo[length]; + for (int i = 0; i < length; ++i) { + final String prevWord; + if (sequentialWords && i > 0) { final String prevWordCandidate = textInfos[i - 1].getText(); // Note that an empty string would be used to indicate the initial word // in the future. prevWord = TextUtils.isEmpty(prevWordCandidate) ? null : prevWordCandidate; - } else { - prevWord = null; + } else { + prevWord = null; + } + retval[i] = onGetSuggestionsInternal(textInfos[i], prevWord, suggestionsLimit); + retval[i].setCookieAndSequence(textInfos[i].getCookie(), + textInfos[i].getSequence()); } - retval[i] = onGetSuggestions(textInfos[i], prevWord, suggestionsLimit); - retval[i].setCookieAndSequence(textInfos[i].getCookie(), - textInfos[i].getSequence()); + return retval; + } finally { + Binder.restoreCallingIdentity(ident); } - return retval; } } |