Loading java/src/com/android/inputmethod/latin/BinaryDictionary.java +3 −1 Original line number Diff line number Diff line Loading @@ -540,7 +540,9 @@ public final class BinaryDictionary extends Dictionary { close(); final File dictFile = new File(mDictFilePath); final File tmpDictFile = new File(tmpDictFilePath); FileUtils.deleteRecursively(dictFile); if (!FileUtils.deleteRecursively(dictFile)) { return false; } if (!BinaryDictionaryUtils.renameDict(tmpDictFile, dictFile)) { return false; } Loading java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +3 −2 Original line number Diff line number Diff line Loading @@ -112,8 +112,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { } private boolean needsToMigrateDictionary(final int formatVersion) { // TODO: Check version. return false; // When we bump up the dictionary format version, the old version should be added to here // for supporting migration. Note that native code has to support reading such formats. return formatVersion == FormatSpec.VERSION4_ONLY_FOR_TESTING; } public boolean isValidDictionaryLocked() { Loading java/src/com/android/inputmethod/latin/makedict/FormatSpec.java +5 −0 Original line number Diff line number Diff line Loading @@ -186,7 +186,12 @@ public final class FormatSpec { // From version 4 on, we use version * 100 + revision as a version number. That allows // us to change the format during development while having testing devices remove // older files with each upgrade, while still having a readable versioning scheme. // When we bump up the dictionary format version, we should update // ExpandableDictionary.needsToMigrateDictionary() and // ExpandableDictionary.matchesExpectedBinaryDictFormatVersionForThisType(). public static final int VERSION2 = 2; // Dictionary version used for testing. public static final int VERSION4_ONLY_FOR_TESTING = 399; public static final int VERSION4 = 401; static final int MINIMUM_SUPPORTED_VERSION = VERSION2; static final int MAXIMUM_SUPPORTED_VERSION = VERSION4; Loading native/jni/src/suggest/policyimpl/dictionary/header/header_policy.h +2 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,8 @@ class HeaderPolicy : public DictionaryHeaderStructurePolicy { switch (mDictFormatVersion) { case FormatUtils::VERSION_2: return FormatUtils::VERSION_2; case FormatUtils::VERSION_4_ONLY_FOR_TESTING: return FormatUtils::VERSION_4_ONLY_FOR_TESTING; case FormatUtils::VERSION_4: return FormatUtils::VERSION_4; default: Loading native/jni/src/suggest/policyimpl/dictionary/header/header_read_write_utils.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -98,8 +98,9 @@ typedef DictionaryHeaderStructurePolicy::AttributeMap AttributeMap; case FormatUtils::VERSION_2: // Version 2 dictionary writing is not supported. return false; case FormatUtils::VERSION_4_ONLY_FOR_TESTING: case FormatUtils::VERSION_4: return buffer->writeUintAndAdvancePosition(FormatUtils::VERSION_4 /* data */, return buffer->writeUintAndAdvancePosition(version /* data */, HEADER_DICTIONARY_VERSION_SIZE, writingPos); default: return false; Loading Loading
java/src/com/android/inputmethod/latin/BinaryDictionary.java +3 −1 Original line number Diff line number Diff line Loading @@ -540,7 +540,9 @@ public final class BinaryDictionary extends Dictionary { close(); final File dictFile = new File(mDictFilePath); final File tmpDictFile = new File(tmpDictFilePath); FileUtils.deleteRecursively(dictFile); if (!FileUtils.deleteRecursively(dictFile)) { return false; } if (!BinaryDictionaryUtils.renameDict(tmpDictFile, dictFile)) { return false; } Loading
java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +3 −2 Original line number Diff line number Diff line Loading @@ -112,8 +112,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { } private boolean needsToMigrateDictionary(final int formatVersion) { // TODO: Check version. return false; // When we bump up the dictionary format version, the old version should be added to here // for supporting migration. Note that native code has to support reading such formats. return formatVersion == FormatSpec.VERSION4_ONLY_FOR_TESTING; } public boolean isValidDictionaryLocked() { Loading
java/src/com/android/inputmethod/latin/makedict/FormatSpec.java +5 −0 Original line number Diff line number Diff line Loading @@ -186,7 +186,12 @@ public final class FormatSpec { // From version 4 on, we use version * 100 + revision as a version number. That allows // us to change the format during development while having testing devices remove // older files with each upgrade, while still having a readable versioning scheme. // When we bump up the dictionary format version, we should update // ExpandableDictionary.needsToMigrateDictionary() and // ExpandableDictionary.matchesExpectedBinaryDictFormatVersionForThisType(). public static final int VERSION2 = 2; // Dictionary version used for testing. public static final int VERSION4_ONLY_FOR_TESTING = 399; public static final int VERSION4 = 401; static final int MINIMUM_SUPPORTED_VERSION = VERSION2; static final int MAXIMUM_SUPPORTED_VERSION = VERSION4; Loading
native/jni/src/suggest/policyimpl/dictionary/header/header_policy.h +2 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,8 @@ class HeaderPolicy : public DictionaryHeaderStructurePolicy { switch (mDictFormatVersion) { case FormatUtils::VERSION_2: return FormatUtils::VERSION_2; case FormatUtils::VERSION_4_ONLY_FOR_TESTING: return FormatUtils::VERSION_4_ONLY_FOR_TESTING; case FormatUtils::VERSION_4: return FormatUtils::VERSION_4; default: Loading
native/jni/src/suggest/policyimpl/dictionary/header/header_read_write_utils.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -98,8 +98,9 @@ typedef DictionaryHeaderStructurePolicy::AttributeMap AttributeMap; case FormatUtils::VERSION_2: // Version 2 dictionary writing is not supported. return false; case FormatUtils::VERSION_4_ONLY_FOR_TESTING: case FormatUtils::VERSION_4: return buffer->writeUintAndAdvancePosition(FormatUtils::VERSION_4 /* data */, return buffer->writeUintAndAdvancePosition(version /* data */, HEADER_DICTIONARY_VERSION_SIZE, writingPos); default: return false; Loading