Loading java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +2 −1 Original line number Diff line number Diff line Loading @@ -120,7 +120,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { private static boolean needsToMigrateDictionary(final int formatVersion) { // 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; return formatVersion == FormatSpec.VERSION4_ONLY_FOR_TESTING || formatVersion == FormatSpec.VERSION402; } public boolean isValidDictionaryLocked() { Loading java/src/com/android/inputmethod/latin/makedict/FormatSpec.java +4 −3 Original line number Diff line number Diff line Loading @@ -175,9 +175,10 @@ public final class FormatSpec { public static final int MINIMUM_SUPPORTED_VERSION_OF_CODE_POINT_TABLE = VERSION201; // Dictionary version used for testing. public static final int VERSION4_ONLY_FOR_TESTING = 399; public static final int VERSION401 = 401; public static final int VERSION4 = 402; public static final int VERSION4_DEV = 403; public static final int VERSION402 = 402; public static final int VERSION403 = 403; public static final int VERSION4 = VERSION403; public static final int VERSION4_DEV = VERSION403; static final int MINIMUM_SUPPORTED_STATIC_VERSION = VERSION202; static final int MAXIMUM_SUPPORTED_STATIC_VERSION = VERSION202; static final int MINIMUM_SUPPORTED_DYNAMIC_VERSION = VERSION4; Loading native/jni/src/suggest/policyimpl/dictionary/header/header_policy.h +5 −5 Original line number Diff line number Diff line Loading @@ -141,10 +141,10 @@ class HeaderPolicy : public DictionaryHeaderStructurePolicy { return FormatUtils::VERSION_202; case FormatUtils::VERSION_4_ONLY_FOR_TESTING: return FormatUtils::VERSION_4_ONLY_FOR_TESTING; case FormatUtils::VERSION_4: return FormatUtils::VERSION_4; case FormatUtils::VERSION_4_DEV: return FormatUtils::VERSION_4_DEV; case FormatUtils::VERSION_402: return FormatUtils::VERSION_402; case FormatUtils::VERSION_403: return FormatUtils::VERSION_403; default: return FormatUtils::UNKNOWN_VERSION; } Loading Loading @@ -247,7 +247,7 @@ class HeaderPolicy : public DictionaryHeaderStructurePolicy { } bool supportsBeginningOfSentence() const { return mDictFormatVersion >= FormatUtils::VERSION_4; return mDictFormatVersion >= FormatUtils::VERSION_402; } const int *getCodePointTable() const { Loading native/jni/src/suggest/policyimpl/dictionary/header/header_read_write_utils.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -115,8 +115,8 @@ typedef DictionaryHeaderStructurePolicy::AttributeMap AttributeMap; // None of the static dictionaries (v2x) support writing return false; case FormatUtils::VERSION_4_ONLY_FOR_TESTING: case FormatUtils::VERSION_4: case FormatUtils::VERSION_4_DEV: case FormatUtils::VERSION_402: case FormatUtils::VERSION_403: return buffer->writeUintAndAdvancePosition(version /* data */, HEADER_DICTIONARY_VERSION_SIZE, writingPos); default: Loading native/jni/src/suggest/policyimpl/dictionary/structure/dictionary_structure_with_buffer_policy_factory.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ namespace latinime { const DictionaryHeaderStructurePolicy::AttributeMap *const attributeMap) { FormatUtils::FORMAT_VERSION dictFormatVersion = FormatUtils::getFormatVersion(formatVersion); switch (dictFormatVersion) { case FormatUtils::VERSION_4: { case FormatUtils::VERSION_402: { return newPolicyForOnMemoryV4Dict<backward::v402::Ver4DictConstants, backward::v402::Ver4DictBuffers, backward::v402::Ver4DictBuffers::Ver4DictBuffersPtr, Loading @@ -66,7 +66,7 @@ namespace latinime { dictFormatVersion, locale, attributeMap); } case FormatUtils::VERSION_4_ONLY_FOR_TESTING: case FormatUtils::VERSION_4_DEV: { case FormatUtils::VERSION_403: { return newPolicyForOnMemoryV4Dict<Ver4DictConstants, Ver4DictBuffers, Ver4DictBuffers::Ver4DictBuffersPtr, Ver4PatriciaTriePolicy>( dictFormatVersion, locale, attributeMap); Loading Loading @@ -118,7 +118,7 @@ template<class DictConstants, class DictBuffers, class DictBuffersPtr, class Str case FormatUtils::VERSION_202: AKLOGE("Given path is a directory but the format is version 2xx. path: %s", path); break; case FormatUtils::VERSION_4: { case FormatUtils::VERSION_402: { return newPolicyForV4Dict<backward::v402::Ver4DictConstants, backward::v402::Ver4DictBuffers, backward::v402::Ver4DictBuffers::Ver4DictBuffersPtr, Loading @@ -126,7 +126,7 @@ template<class DictConstants, class DictBuffers, class DictBuffersPtr, class Str headerFilePath, formatVersion, std::move(mmappedBuffer)); } case FormatUtils::VERSION_4_ONLY_FOR_TESTING: case FormatUtils::VERSION_4_DEV: { case FormatUtils::VERSION_403: { return newPolicyForV4Dict<Ver4DictConstants, Ver4DictBuffers, Ver4DictBuffers::Ver4DictBuffersPtr, Ver4PatriciaTriePolicy>( headerFilePath, formatVersion, std::move(mmappedBuffer)); Loading Loading @@ -184,8 +184,8 @@ template<class DictConstants, class DictBuffers, class DictBuffersPtr, class Str return DictionaryStructureWithBufferPolicy::StructurePolicyPtr( new PatriciaTriePolicy(std::move(mmappedBuffer))); case FormatUtils::VERSION_4_ONLY_FOR_TESTING: case FormatUtils::VERSION_4: case FormatUtils::VERSION_4_DEV: case FormatUtils::VERSION_402: case FormatUtils::VERSION_403: AKLOGE("Given path is a file but the format is version 4. path: %s", path); break; default: Loading Loading
java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +2 −1 Original line number Diff line number Diff line Loading @@ -120,7 +120,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { private static boolean needsToMigrateDictionary(final int formatVersion) { // 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; return formatVersion == FormatSpec.VERSION4_ONLY_FOR_TESTING || formatVersion == FormatSpec.VERSION402; } public boolean isValidDictionaryLocked() { Loading
java/src/com/android/inputmethod/latin/makedict/FormatSpec.java +4 −3 Original line number Diff line number Diff line Loading @@ -175,9 +175,10 @@ public final class FormatSpec { public static final int MINIMUM_SUPPORTED_VERSION_OF_CODE_POINT_TABLE = VERSION201; // Dictionary version used for testing. public static final int VERSION4_ONLY_FOR_TESTING = 399; public static final int VERSION401 = 401; public static final int VERSION4 = 402; public static final int VERSION4_DEV = 403; public static final int VERSION402 = 402; public static final int VERSION403 = 403; public static final int VERSION4 = VERSION403; public static final int VERSION4_DEV = VERSION403; static final int MINIMUM_SUPPORTED_STATIC_VERSION = VERSION202; static final int MAXIMUM_SUPPORTED_STATIC_VERSION = VERSION202; static final int MINIMUM_SUPPORTED_DYNAMIC_VERSION = VERSION4; Loading
native/jni/src/suggest/policyimpl/dictionary/header/header_policy.h +5 −5 Original line number Diff line number Diff line Loading @@ -141,10 +141,10 @@ class HeaderPolicy : public DictionaryHeaderStructurePolicy { return FormatUtils::VERSION_202; case FormatUtils::VERSION_4_ONLY_FOR_TESTING: return FormatUtils::VERSION_4_ONLY_FOR_TESTING; case FormatUtils::VERSION_4: return FormatUtils::VERSION_4; case FormatUtils::VERSION_4_DEV: return FormatUtils::VERSION_4_DEV; case FormatUtils::VERSION_402: return FormatUtils::VERSION_402; case FormatUtils::VERSION_403: return FormatUtils::VERSION_403; default: return FormatUtils::UNKNOWN_VERSION; } Loading Loading @@ -247,7 +247,7 @@ class HeaderPolicy : public DictionaryHeaderStructurePolicy { } bool supportsBeginningOfSentence() const { return mDictFormatVersion >= FormatUtils::VERSION_4; return mDictFormatVersion >= FormatUtils::VERSION_402; } const int *getCodePointTable() const { Loading
native/jni/src/suggest/policyimpl/dictionary/header/header_read_write_utils.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -115,8 +115,8 @@ typedef DictionaryHeaderStructurePolicy::AttributeMap AttributeMap; // None of the static dictionaries (v2x) support writing return false; case FormatUtils::VERSION_4_ONLY_FOR_TESTING: case FormatUtils::VERSION_4: case FormatUtils::VERSION_4_DEV: case FormatUtils::VERSION_402: case FormatUtils::VERSION_403: return buffer->writeUintAndAdvancePosition(version /* data */, HEADER_DICTIONARY_VERSION_SIZE, writingPos); default: Loading
native/jni/src/suggest/policyimpl/dictionary/structure/dictionary_structure_with_buffer_policy_factory.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ namespace latinime { const DictionaryHeaderStructurePolicy::AttributeMap *const attributeMap) { FormatUtils::FORMAT_VERSION dictFormatVersion = FormatUtils::getFormatVersion(formatVersion); switch (dictFormatVersion) { case FormatUtils::VERSION_4: { case FormatUtils::VERSION_402: { return newPolicyForOnMemoryV4Dict<backward::v402::Ver4DictConstants, backward::v402::Ver4DictBuffers, backward::v402::Ver4DictBuffers::Ver4DictBuffersPtr, Loading @@ -66,7 +66,7 @@ namespace latinime { dictFormatVersion, locale, attributeMap); } case FormatUtils::VERSION_4_ONLY_FOR_TESTING: case FormatUtils::VERSION_4_DEV: { case FormatUtils::VERSION_403: { return newPolicyForOnMemoryV4Dict<Ver4DictConstants, Ver4DictBuffers, Ver4DictBuffers::Ver4DictBuffersPtr, Ver4PatriciaTriePolicy>( dictFormatVersion, locale, attributeMap); Loading Loading @@ -118,7 +118,7 @@ template<class DictConstants, class DictBuffers, class DictBuffersPtr, class Str case FormatUtils::VERSION_202: AKLOGE("Given path is a directory but the format is version 2xx. path: %s", path); break; case FormatUtils::VERSION_4: { case FormatUtils::VERSION_402: { return newPolicyForV4Dict<backward::v402::Ver4DictConstants, backward::v402::Ver4DictBuffers, backward::v402::Ver4DictBuffers::Ver4DictBuffersPtr, Loading @@ -126,7 +126,7 @@ template<class DictConstants, class DictBuffers, class DictBuffersPtr, class Str headerFilePath, formatVersion, std::move(mmappedBuffer)); } case FormatUtils::VERSION_4_ONLY_FOR_TESTING: case FormatUtils::VERSION_4_DEV: { case FormatUtils::VERSION_403: { return newPolicyForV4Dict<Ver4DictConstants, Ver4DictBuffers, Ver4DictBuffers::Ver4DictBuffersPtr, Ver4PatriciaTriePolicy>( headerFilePath, formatVersion, std::move(mmappedBuffer)); Loading Loading @@ -184,8 +184,8 @@ template<class DictConstants, class DictBuffers, class DictBuffersPtr, class Str return DictionaryStructureWithBufferPolicy::StructurePolicyPtr( new PatriciaTriePolicy(std::move(mmappedBuffer))); case FormatUtils::VERSION_4_ONLY_FOR_TESTING: case FormatUtils::VERSION_4: case FormatUtils::VERSION_4_DEV: case FormatUtils::VERSION_402: case FormatUtils::VERSION_403: AKLOGE("Given path is a file but the format is version 4. path: %s", path); break; default: Loading