aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
diff options
context:
space:
mode:
authorKeisuke Kuroynagi <ksk@google.com>2013-07-01 15:25:33 +0900
committerKeisuke Kuroynagi <ksk@google.com>2013-07-01 15:25:33 +0900
commita62b5b22eff2c1842fe1e0a4ea949e1e004de40b (patch)
tree567b46d5bb539ff574497b6398815415287dfe48 /java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
parente04794cbbeafec7463a91554d7c069deacddc744 (diff)
downloadlatinime-a62b5b22eff2c1842fe1e0a4ea949e1e004de40b.tar.gz
latinime-a62b5b22eff2c1842fe1e0a4ea949e1e004de40b.tar.xz
latinime-a62b5b22eff2c1842fe1e0a4ea949e1e004de40b.zip
Regenerate old version dictionaries using new format.
Bug: 9617181 Change-Id: I228a3eac959f81b38e4092015e8e3c429d46fa60
Diffstat (limited to 'java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java')
-rw-r--r--java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
index 9cdb86c2d..a19363d54 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
@@ -92,7 +92,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
/** Controls access to the local binary dictionary for this instance. */
private final DictionaryController mLocalDictionaryController = new DictionaryController();
- private static final int BINARY_DICT_VERSION = 1;
+ // TODO: Regenerate version 3 binary dictionary.
+ private static final int BINARY_DICT_VERSION = 2;
private static final FormatSpec.FormatOptions FORMAT_OPTIONS =
new FormatSpec.FormatOptions(BINARY_DICT_VERSION);
@@ -415,6 +416,12 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
// shared dictionary.
loadBinaryDictionary();
}
+ if (mBinaryDictionary != null && !mBinaryDictionary.isValidDictionary()) {
+ // Binary dictionary is not valid. Regenerate the dictionary file.
+ mSharedDictionaryController.mLastUpdateTime = time;
+ generateBinaryDictionary();
+ loadBinaryDictionary();
+ }
mLocalDictionaryController.mLastUpdateTime = time;
} finally {
mSharedDictionaryController.unlock();