Change how to load native lib to be on the safe side

Change-Id: If170d4821b8dbc187f29137ea99d10e30c20955f
This commit is contained in:
Ken Wakasa 2011-02-25 18:21:02 +09:00
parent 52e96f1e89
commit eaef1c5007
4 changed files with 16 additions and 8 deletions

View file

@ -16,6 +16,8 @@
package com.android.inputmethod.keyboard;
import com.android.inputmethod.latin.Utils;
public class ProximityInfo {
public static final int MAX_PROXIMITY_CHARS_SIZE = 16;
@ -34,6 +36,9 @@ public class ProximityInfo {
}
private int mNativeProximityInfo;
static {
Utils.loadNativeLibrary();
}
private native int setProximityInfoNative(int maxProximityCharsSize, int displayWidth,
int displayHeight, int gridWidth, int gridHeight, int[] proximityCharsArray);
private native void releaseProximityInfoNative(int nativeProximityInfo);

View file

@ -109,6 +109,9 @@ public class BinaryDictionary extends Dictionary {
return sInstance;
}
static {
Utils.loadNativeLibrary();
}
private native int openNative(String sourceDir, long dictOffset, long dictSize,
int typedLetterMultiplier, int fullWordMultiplier, int maxWordLength,
int maxWords, int maxAlternatives);

View file

@ -211,14 +211,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private final ArrayList<WordAlternatives> mWordHistory = new ArrayList<WordAlternatives>();
static {
try {
System.loadLibrary("jni_latinime");
} catch (UnsatisfiedLinkError ule) {
Log.e(TAG, "Could not load native library jni_latinime");
}
}
public abstract static class WordAlternatives {
protected CharSequence mChosenWord;

View file

@ -553,4 +553,12 @@ public class Utils {
public static int getMainDictionaryResourceId(Resources res) {
return res.getIdentifier("main", "raw", LatinIME.class.getPackage().getName());
}
public static void loadNativeLibrary() {
try {
System.loadLibrary("jni_latinime");
} catch (UnsatisfiedLinkError ule) {
Log.e(TAG, "Could not load native library jni_latinime");
}
}
}