[Libreoffice-commits] .: 5 commits - android/Bootstrap android/experiments sal/android
Tor Lillqvist
tml at kemper.freedesktop.org
Mon Apr 2 02:45:18 PDT 2012
android/Bootstrap/src/org/libreoffice/android/Bootstrap.java | 27 +++++
android/experiments/DocumentLoader/Makefile | 18 +++
android/experiments/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java | 3
sal/android/lo-bootstrap.c | 49 +++++++---
4 files changed, 83 insertions(+), 14 deletions(-)
New commits:
commit 6b6ca3d1168323651e87c51268b5c0c37532999b
Author: Tor Lillqvist <tlillqvist at suse.com>
Date: Mon Apr 2 12:39:31 2012 +0300
Automate setting of FONTCONFIG_FILE
diff --git a/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java b/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java
index 443b770..98df770 100644
--- a/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java
+++ b/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java
@@ -127,6 +127,18 @@ public class Bootstrap extends NativeActivity
// Extract files from the .apk that can't be used mmapped directly from it
extract_files();
+
+ // If we notice that a fonts.conf file was extracted, automatically
+ // set the FONTCONFIG_FILE env var.
+ InputStream i;
+ try {
+ i = activity.getAssets().open("unpack/etc/fonts/fonts.conf");
+ }
+ catch (java.io.IOException e) {
+ i = null;
+ }
+ if (i != null)
+ putenv("FONTCONFIG_FILE=" + dataDir + "/etc/fonts/fonts.conf");
}
@Override
commit 366cba7d6f3a100d51b576927dde446ab36e9483
Author: Tor Lillqvist <tlillqvist at suse.com>
Date: Mon Apr 2 12:38:48 2012 +0300
Add fonts.conf to this app, too
diff --git a/android/experiments/DocumentLoader/Makefile b/android/experiments/DocumentLoader/Makefile
index 2bacbbb..76210a0 100644
--- a/android/experiments/DocumentLoader/Makefile
+++ b/android/experiments/DocumentLoader/Makefile
@@ -196,6 +196,9 @@ copy-stuff:
echo 'ProductMinor=1' >> assets/program/versionrc
echo 'ProductSource=OOO350' >> assets/program/versionrc
echo 'ReferenceOOoMajorMinor=3.6' >> assets/program/versionrc
+# Assets that are unpacked at run-time into the app's data directory.
+ mkdir -p assets/unpack/etc/fonts
+ cp fonts.conf assets/unpack/etc/fonts
#
# Then gdbserver and gdb.setup so that we can debug with ndk-gdb.
#
commit a9a50cd9ffcd53c631fd13d20aa7e0609d92fc4d
Author: Tor Lillqvist <tlillqvist at suse.com>
Date: Mon Apr 2 12:38:23 2012 +0300
Refactor where patch_libgnustl_shared() and extract_files() are called
diff --git a/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java b/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java
index c60c9e9..443b770 100644
--- a/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java
+++ b/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java
@@ -38,6 +38,7 @@ import android.util.Log;
import fi.iki.tml.CommandLine;
import java.io.File;
+import java.io.InputStream;
import java.util.Arrays;
import java.util.Scanner;
@@ -73,7 +74,10 @@ public class Bootstrap extends NativeActivity
// To be called after you are sure libgnustl_shared.so
// has been loaded
- public static native void patch_libgnustl_shared();
+ static native void patch_libgnustl_shared();
+
+ // Extracts files in the .apk that need to be extraced into the app's tree
+ static native void extract_files();
// Wrapper for getpid()
public static native int getpid();
@@ -97,6 +101,8 @@ public class Bootstrap extends NativeActivity
// (contentbroker.cxx), also this called indirectly through the lo-bootstrap library
public static native void initUCBHelper();
+ // This setup() method is called 1) in apps that use *this* class as their activity from onCreate(),
+ // and 2) should be called from other kinds of LO code using apps.
public static void setup(Activity activity)
{
String dataDir = null;
@@ -114,6 +120,13 @@ public class Bootstrap extends NativeActivity
if (!setup(dataDir, activity.getApplication().getPackageResourcePath(), llpa))
return;
+ // We build LO code against the shared GNU C++ library
+ dlopen("libgnustl_shared.so");
+ // and need to patch it.
+ patch_libgnustl_shared();
+
+ // Extract files from the .apk that can't be used mmapped directly from it
+ extract_files();
}
@Override
diff --git a/android/experiments/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java b/android/experiments/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
index d47a6ef..93ed87e 100644
--- a/android/experiments/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
+++ b/android/experiments/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
@@ -52,9 +52,6 @@ public class DocumentLoader
Bootstrap.putenv("SAL_LOG=yes");
- Bootstrap.dlopen("libgnustl_shared.so");
- Bootstrap.patch_libgnustl_shared();
-
// Load a lot of shlibs here explicitly in advance because that
// makes debugging work better, sigh
Bootstrap.dlopen("libvcllo.so");
diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c
index a216e0d..75a3898 100644
--- a/sal/android/lo-bootstrap.c
+++ b/sal/android/lo-bootstrap.c
@@ -1518,7 +1518,7 @@ extract_files(const char *prefix)
lo_apk_closedir(tree);
}
-// public static native void patch_libgnustl_shared();
+// static native void patch_libgnustl_shared();
__attribute__ ((visibility("default")))
void
@@ -1531,6 +1531,19 @@ Java_org_libreoffice_android_Bootstrap_patch_1libgnustl_1shared(JNIEnv* env,
patch_libgnustl_shared();
}
+// static native void extract_files();
+
+__attribute__ ((visibility("default")))
+void
+Java_org_libreoffice_android_Bootstrap_extract_1files(JNIEnv* env,
+ jobject clazz)
+{
+ (void) env;
+ (void) clazz;
+
+ extract_files(UNPACK_TREE);
+}
+
/* Android's JNI works only to libraries loaded through Java's
* System.loadLibrary(), it seems. Not to functions loaded by a dlopen() call
* in native code. For instance, to call a function in libvcllo.so, we need to
@@ -1666,10 +1679,6 @@ android_main(struct android_app* state)
lo_main_argv[0] = lo_main_info.dli_fname;
}
- patch_libgnustl_shared();
-
- extract_files(UNPACK_TREE);
-
lo_main(lo_main_argc, lo_main_argv);
fprintf (stderr, "exit android_main\n");
}
commit 2906a654d0c59adae71f4c0fb1c72adb3d5477a0
Author: Tor Lillqvist <tlillqvist at suse.com>
Date: Mon Apr 2 11:06:24 2012 +0300
More libs
diff --git a/android/experiments/DocumentLoader/Makefile b/android/experiments/DocumentLoader/Makefile
index ddf5146..2bacbbb 100644
--- a/android/experiments/DocumentLoader/Makefile
+++ b/android/experiments/DocumentLoader/Makefile
@@ -48,8 +48,10 @@ copy-stuff:
basebmplo \
basegfxlo \
bootstrap.uno \
+ cdrimportlo \
comphelpgcc3 \
datelo \
+ dbaxmllo \
expwrap.uno \
fastsax.uno \
fileacc \
@@ -59,6 +61,7 @@ copy-stuff:
freetype \
frmlo \
gcc3_uno \
+ hwplo \
i18nisolang1gcc3 \
i18npaperlo \
i18npool.uno \
@@ -76,18 +79,26 @@ copy-stuff:
lo-bootstrap \
localedata_en \
localedata_others \
+ lwpftlo \
mergedlo \
msfilterlo \
+ msworkslo \
ooxlo \
reflection.uno \
reg \
saxlo \
sclo \
+ scdlo \
scfiltlo \
+ sddlo \
+ smdlo \
sotlo \
stocservices.uno \
store \
+ svgfilterlo \
svllo \
+ swdlo \
+ t602filterlo \
textinstream.uno \
tllo \
ucbhelper4gcc3 \
@@ -100,7 +111,11 @@ copy-stuff:
utllo \
vbahelperlo \
vcllo \
+ visioimportlo \
+ wpftlo \
+ wpgimportlo \
xml2 \
+ xmlfdlo \
xmlreader \
xstor \
); do \
commit d975f4aab223680260140383f5c16dd31f9cc71d
Author: Tor Lillqvist <tlillqvist at suse.com>
Date: Mon Apr 2 11:05:54 2012 +0300
Add a JNI_OnLoad() to store the JavaVM* also from non-NativeActivity apps
diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c
index a79b9dd..a216e0d 100644
--- a/sal/android/lo-bootstrap.c
+++ b/sal/android/lo-bootstrap.c
@@ -71,16 +71,22 @@ struct engine {
int dummy;
};
+/* These vars are valid / used only when this library is used from
+ * NativeActivity-based apps.
+ */
static struct android_app *app;
-static const char *data_dir;
-static const char **library_locations;
-static void *apk_file;
-static int apk_file_size;
static int (*lo_main)(int, const char **);
static int lo_main_argc;
static const char **lo_main_argv;
static int sleep_time = 0;
+/* These are valid / used in all apps. */
+static const char *data_dir;
+static const char **library_locations;
+static void *apk_file;
+static int apk_file_size;
+static JavaVM *the_java_vm;
+
/* Zip data structures */
/* compression methods */
@@ -323,6 +329,20 @@ free_ptrarray(void **pa)
free(pa);
}
+/* The lo-bootstrap shared library is always loaded from Java, so
+ * this is always called by JNI first.
+ */
+__attribute__ ((visibility("default")))
+jint
+JNI_OnLoad(JavaVM* vm, void* reserved)
+{
+ (void) reserved;
+
+ the_java_vm = vm;
+
+ return JNI_VERSION_1_2;
+}
+
__attribute__ ((visibility("default")))
jobjectArray
Java_org_libreoffice_android_Bootstrap_dlneeds(JNIEnv* env,
@@ -1602,7 +1622,7 @@ __attribute__ ((visibility("default")))
JavaVM *
lo_get_javavm(void)
{
- return app->activity->vm;
+ return the_java_vm;
}
__attribute__ ((visibility("default")))
More information about the Libreoffice-commits
mailing list