From 61cb852d336543f120a9fa51fc40dda6b639da39 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Mon, 21 Apr 2014 16:22:00 -0700 Subject: [PATCH] Add jni interface to use on memory dictionary. Bug; 14166482 Change-Id: I33ab08dad1e39aa7617d391f7eb2561d6f2504bb --- .../android/inputmethod/latin/BinaryDictionary.java | 2 ++ ...om_android_inputmethod_latin_BinaryDictionary.cpp | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java index 621eb2dfa..e9b8431e7 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -151,6 +151,8 @@ public final class BinaryDictionary extends Dictionary { private static native long openNative(String sourceDir, long dictOffset, long dictSize, boolean isUpdatable); + private static native long createOnMemoryNative(long formatVersion, + String locale, String[] attributeKeyStringArray, String[] attributeValueStringArray); private static native void getHeaderInfoNative(long dict, int[] outHeaderSize, int[] outFormatVersion, ArrayList outAttributeKeys, ArrayList outAttributeValues); diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp index 0cb66146f..b2946da9c 100644 --- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp +++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp @@ -65,6 +65,13 @@ static jlong latinime_BinaryDictionary_open(JNIEnv *env, jclass clazz, jstring s return reinterpret_cast(dictionary); } +static jlong latinime_BinaryDictionary_createOnMemory(JNIEnv *env, jclass clazz, + jlong formatVersion, jstring locale, jobjectArray attributeKeyStringArray, + jobjectArray attributeValueStringArray) { + // TODO: Implement. + return 0; +} + static void latinime_BinaryDictionary_flush(JNIEnv *env, jclass clazz, jlong dict, jstring filePath) { Dictionary *dictionary = reinterpret_cast(dict); @@ -467,6 +474,11 @@ static const JNINativeMethod sMethods[] = { const_cast("(Ljava/lang/String;JJZ)J"), reinterpret_cast(latinime_BinaryDictionary_open) }, + { + const_cast("createOnMemoryNative"), + const_cast("(JLjava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)J"), + reinterpret_cast(latinime_BinaryDictionary_createOnMemory) + }, { const_cast("closeNative"), const_cast("(J)V"),