diff options
author | 2015-02-20 18:30:23 -0800 | |
---|---|---|
committer | 2015-02-20 18:30:23 -0800 | |
commit | eeeec21baceea10bd1f96cfc5395fae7ec837f0c (patch) | |
tree | aada316e868b71370f8053c6bf255ed8666fe6d1 /java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java | |
parent | fe3c4ef9401d7cdcf07498d97820980fa90528fb (diff) | |
download | latinime-eeeec21baceea10bd1f96cfc5395fae7ec837f0c.tar.gz latinime-eeeec21baceea10bd1f96cfc5395fae7ec837f0c.tar.xz latinime-eeeec21baceea10bd1f96cfc5395fae7ec837f0c.zip |
Make checksum and header checks decoder dependent.
Change-Id: I0ec4aa69d9b5f013ae926cc368e25225d9d3073b
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java | 8 |
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); |