diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-11-17 10:44:04 +0100 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-12-04 23:04:27 +0100 |
commit | 333a894ba84553762542c47636791f92360c69b5 (patch) | |
tree | 008016ec1fd0df7c322333ddd261ee8a2af9cd7d /android/Bootstrap | |
parent | 8dc0d82aadb7d6b2a9429a520f121f7dc4c47c1d (diff) |
android: cleanup LibreOfficeKit initialization in Java
Change-Id: I7688968e92ae4b3d6fef19c4544ae91bdcd8b1b9
Diffstat (limited to 'android/Bootstrap')
-rw-r--r-- | android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java b/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java index afd81b33eff3..4fe2061c335b 100644 --- a/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java +++ b/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java @@ -15,27 +15,23 @@ import android.util.Log; import java.io.InputStream; -// final because subclassing would be meaningless. +// Native methods in this class are all implemented in +// sal/android/lo-bootstrap.c as the lo-bootstrap library is loaded with +// System.loadLibrary() and Android's JNI works only to such libraries, it +// seems. public final class LibreOfficeKit { - private long handle; - - public static void loadStatic() { - - } + private static String LOGTAG = LibreOfficeKit.class.getSimpleName(); // private constructor because instantiating would be meaningless - private LibreOfficeKit() - { + private LibreOfficeKit() { } - private static String TAG = "LibreOfficeKit"; - - // Native methods in this class are all implemented in - // sal/android/lo-bootstrap.c as the lo-bootstrap library is loaded with - // System.loadLibrary() and Android's JNI works only to such libraries, it - // seems. + // Trigger library initialization - as this is done automatically by executing the "static" block, this method remains empty. However we need this to manually (at the right time) can force library initialization. + public static void initializeLibrary() { + } + // Trigger initialization on the JNI - LOKit side. private static native boolean initializeNative(String dataDir, String cacheDir, String apkFile); public static native long getLibreOfficeKitHandle(); @@ -53,14 +49,15 @@ public final class LibreOfficeKit // LO-based apps. public static synchronized void init(Activity activity) { - if (initializeDone) + if (initializeDone) { return; + } String dataDir = null; ApplicationInfo applicationInfo = activity.getApplicationInfo(); dataDir = applicationInfo.dataDir; - Log.i(TAG, String.format("Initializing LibreOfficeKit, dataDir=%s\n", dataDir)); + Log.i(LOGTAG, String.format("Initializing LibreOfficeKit, dataDir=%s\n", dataDir)); redirectStdio(true); @@ -85,6 +82,7 @@ public final class LibreOfficeKit putenv("TMPDIR=" + activity.getCacheDir().getAbsolutePath()); if (!initializeNative(dataDir, cacheDir, apkFile)) { + Log.i(LOGTAG, "Initialize native failed!"); return; } |