aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
diff options
context:
space:
mode:
authorMohammadinamul Sheik <inamul@google.com>2015-02-23 21:47:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-02-23 21:47:28 +0000
commitbae3c4bac563d2379b462334b55ee78cc24ba0a0 (patch)
tree4e495d16c30f69d5bc2244d8362416021f6eef2d /java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
parent53b4bfdba01477860993bff29eefc337e3fd1d99 (diff)
parenteeeec21baceea10bd1f96cfc5395fae7ec837f0c (diff)
downloadlatinime-bae3c4bac563d2379b462334b55ee78cc24ba0a0.tar.gz
latinime-bae3c4bac563d2379b462334b55ee78cc24ba0a0.tar.xz
latinime-bae3c4bac563d2379b462334b55ee78cc24ba0a0.zip
Merge "Make checksum and header checks decoder dependent."
Diffstat (limited to '')
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
index 9c70cad0a..e00532aa6 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
@@ -22,6 +22,7 @@ import android.content.res.AssetFileDescriptor;
import android.util.Log;
import com.android.inputmethod.latin.common.LocaleUtils;
+import com.android.inputmethod.latin.define.DecoderSpecificConstants;
import com.android.inputmethod.latin.makedict.DictionaryHeader;
import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
import com.android.inputmethod.latin.utils.BinaryDictionaryUtils;
@@ -54,6 +55,9 @@ final public class BinaryDictionaryGetter {
*/
private static final String COMMON_PREFERENCES_NAME = "LatinImeDictPrefs";
+ private static final boolean SHOULD_USE_DICT_VERSION =
+ DecoderSpecificConstants.SHOULD_USE_DICT_VERSION;
+
// Name of the category for the main dictionary
public static final String MAIN_DICTIONARY_CATEGORY = "main";
public static final String ID_CATEGORY_SEPARATOR = ":";
@@ -224,6 +228,10 @@ final public class BinaryDictionaryGetter {
// those do not include whitelist entries, the new code with an old version of the dictionary
// would lose whitelist functionality.
private static boolean hackCanUseDictionaryFile(final File file) {
+ if (!SHOULD_USE_DICT_VERSION) {
+ return true;
+ }
+
try {
// Read the version of the file
final DictionaryHeader header = BinaryDictionaryUtils.getHeader(file);