summaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/UserBinaryDictionary.java')
-rw-r--r--java/src/com/android/inputmethod/latin/UserBinaryDictionary.java43
1 files changed, 3 insertions, 40 deletions
diff --git a/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java b/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java
index bd0e75f6b..fe24ccfc2 100644
--- a/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java
@@ -25,7 +25,6 @@ import android.net.Uri;
import android.provider.UserDictionary.Words;
import android.text.TextUtils;
import android.util.Log;
-import android.os.Build;
import com.android.inputmethod.annotations.ExternallyReferenced;
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
@@ -48,19 +47,7 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
private static final int HISTORICAL_DEFAULT_USER_DICTIONARY_FREQUENCY = 250;
private static final int LATINIME_DEFAULT_USER_DICTIONARY_FREQUENCY = 160;
- // Shortcut frequency is 0~15, with 15 = whitelist. We don't want user dictionary entries
- // to auto-correct, so we set this to the highest frequency that won't, i.e. 14.
- private static final int USER_DICT_SHORTCUT_FREQUENCY = 14;
-
- private static final String[] PROJECTION_QUERY_WITH_SHORTCUT = new String[] {
- Words.WORD,
- Words.SHORTCUT,
- Words.FREQUENCY,
- };
- private static final String[] PROJECTION_QUERY_WITHOUT_SHORTCUT = new String[] {
- Words.WORD,
- Words.FREQUENCY,
- };
+ private static final String[] PROJECTION_QUERY = new String[] {Words.WORD, Words.FREQUENCY};
private static final String NAME = "userunigram";
@@ -172,20 +159,7 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
requestArguments = localeElements;
}
final String requestString = request.toString();
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- try {
- addWordsFromProjectionLocked(PROJECTION_QUERY_WITH_SHORTCUT, requestString,
- requestArguments);
- } catch (IllegalArgumentException e) {
- // This may happen on some non-compliant devices where the declared API is JB+ but
- // the SHORTCUT column is not present for some reason.
- addWordsFromProjectionLocked(PROJECTION_QUERY_WITHOUT_SHORTCUT, requestString,
- requestArguments);
- }
- } else {
- addWordsFromProjectionLocked(PROJECTION_QUERY_WITHOUT_SHORTCUT, requestString,
- requestArguments);
- }
+ addWordsFromProjectionLocked(PROJECTION_QUERY, requestString, requestArguments);
}
private void addWordsFromProjectionLocked(final String[] query, String request,
@@ -220,31 +194,20 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
}
private void addWordsLocked(final Cursor cursor) {
- final boolean hasShortcutColumn = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
if (cursor == null) return;
if (cursor.moveToFirst()) {
final int indexWord = cursor.getColumnIndex(Words.WORD);
- final int indexShortcut = hasShortcutColumn ? cursor.getColumnIndex(Words.SHORTCUT) : 0;
final int indexFrequency = cursor.getColumnIndex(Words.FREQUENCY);
while (!cursor.isAfterLast()) {
final String word = cursor.getString(indexWord);
- final String shortcut = hasShortcutColumn ? cursor.getString(indexShortcut) : null;
final int frequency = cursor.getInt(indexFrequency);
final int adjustedFrequency = scaleFrequencyFromDefaultToLatinIme(frequency);
// Safeguard against adding really long words.
if (word.length() <= MAX_WORD_LENGTH) {
runGCIfRequiredLocked(true /* mindsBlockByGC */);
- addUnigramLocked(word, adjustedFrequency, null /* shortcutTarget */,
- 0 /* shortcutFreq */, false /* isNotAWord */,
+ addUnigramLocked(word, adjustedFrequency, false /* isNotAWord */,
false /* isPossiblyOffensive */,
BinaryDictionary.NOT_A_VALID_TIMESTAMP);
- if (null != shortcut && shortcut.length() <= MAX_WORD_LENGTH) {
- runGCIfRequiredLocked(true /* mindsBlockByGC */);
- addUnigramLocked(shortcut, adjustedFrequency, word,
- USER_DICT_SHORTCUT_FREQUENCY, true /* isNotAWord */,
- false /* isPossiblyOffensive */,
- BinaryDictionary.NOT_A_VALID_TIMESTAMP);
- }
}
cursor.moveToNext();
}