summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2019-02-15 11:46:36 +0100
committerJan Holesovsky <kendy@collabora.com>2019-06-05 22:19:31 +0200
commit0b2431e796b0a185a82b1dd6ea3cdd5003f15968 (patch)
treeec43921693772afc21ff981a8bb3058f7029e845
parentfc5199b098afe06234c9fb812f67102a20e69b35 (diff)
android: Separate the Android-specific setup from the actual LOK init.
Change-Id: I433376dfea0a43c63827ba15308a614f3466fb71 Reviewed-on: https://gerrit.libreoffice.org/67875 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java5
-rw-r--r--android/Bootstrap/version.map2
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitInit.h4
-rw-r--r--sal/android/libreofficekit-jni.c29
4 files changed, 24 insertions, 16 deletions
diff --git a/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java b/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java
index c82f7b16b01a..ce84b7409c1f 100644
--- a/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java
+++ b/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java
@@ -76,15 +76,10 @@ public final class LibreOfficeKit
inputStream = null;
}
- putenv("OOO_DISABLE_RECOVERY=1");
-
if (inputStream != null) {
putenv("FONTCONFIG_FILE=" + dataDir + "/etc/fonts/fonts.conf");
}
- // TMPDIR is used by osl_getTempDirURL()
- putenv("TMPDIR=" + cacheDir);
-
if (!initializeNative(dataDir, cacheDir, apkFile, mgr)) {
Log.e(LOGTAG, "Initialize native failed!");
return;
diff --git a/android/Bootstrap/version.map b/android/Bootstrap/version.map
index de561bfc296b..930e1e071999 100644
--- a/android/Bootstrap/version.map
+++ b/android/Bootstrap/version.map
@@ -3,7 +3,7 @@ dummy {
Java_*;
JNI_OnLoad;
_ZTI*; _ZTS*; # weak RTTI symbols for C++ exceptions
- libreofficekit_hook*;
+ libreofficekit_*;
local:
*;
};
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h
index 5c600b5022bf..f2a6d868102d 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -250,13 +250,13 @@ typedef LibreOfficeKit *(LokHookFunction2)( const char *install_path, const char
typedef int (LokHookPreInit) ( const char *install_path, const char *user_profile_url );
-#if defined(IOS)
+#if defined(IOS) || defined(ANDROID)
LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* user_profile_path);
#endif
static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_profile_url )
{
-#if !defined(IOS)
+#if !defined(IOS) && !defined(ANDROID)
void *dlhandle;
char *imp_lib;
LokHookFunction *pSym;
diff --git a/sal/android/libreofficekit-jni.c b/sal/android/libreofficekit-jni.c
index 4cd6594780e4..abbf3edaed10 100644
--- a/sal/android/libreofficekit-jni.c
+++ b/sal/android/libreofficekit-jni.c
@@ -65,8 +65,7 @@ void Java_org_libreoffice_kit_LibreOfficeKit_redirectStdio
/// Initialize the LibreOfficeKit.
__attribute__ ((visibility("default")))
-jboolean Java_org_libreoffice_kit_LibreOfficeKit_initializeNative
- (JNIEnv* env, jobject clazz,
+jboolean libreofficekit_initialize(JNIEnv* env,
jstring dataDir, jstring cacheDir, jstring apkFile, jobject assetManager)
{
struct stat st;
@@ -75,10 +74,7 @@ jboolean Java_org_libreoffice_kit_LibreOfficeKit_initializeNative
const char *cacheDirPath;
const char *apkFilePath;
- const char program_dir[] = "/program";
- size_t data_dir_len;
-
- (void) clazz;
+ setenv("OOO_DISABLE_RECOVERY", "1", 1);
native_asset_manager = AAssetManager_fromJava(env, assetManager);
@@ -90,6 +86,9 @@ jboolean Java_org_libreoffice_kit_LibreOfficeKit_initializeNative
cache_dir = strdup(cacheDirPath);
(*env)->ReleaseStringUTFChars(env, cacheDir, cacheDirPath);
+ // TMPDIR is used by osl_getTempDirURL()
+ setenv("TMPDIR", cache_dir, 1);
+
apkFilePath = (*env)->GetStringUTFChars(env, apkFile, NULL);
fd = open(apkFilePath, O_RDONLY);
@@ -128,6 +127,21 @@ jboolean Java_org_libreoffice_kit_LibreOfficeKit_initializeNative
return JNI_FALSE;
}
+ LOGI("LibreOfficeKit: libreofficekit_initialize finished");
+}
+
+/// Initialize the LibreOfficeKit.
+__attribute__ ((visibility("default")))
+jboolean Java_org_libreoffice_kit_LibreOfficeKit_initializeNative
+ (JNIEnv* env, jobject clazz,
+ jstring dataDir, jstring cacheDir, jstring apkFile, jobject assetManager)
+{
+ const char program_dir[] = "/program";
+ size_t data_dir_len;
+
+ (void) clazz;
+ libreofficekit_initialize(env, dataDir, cacheDir, apkFile, assetManager);
+
// LibreOfficeKit expects a path to the program/ directory
free(full_program_dir);
data_dir_len = strlen(data_dir);
@@ -166,8 +180,7 @@ __attribute__ ((visibility("default")))
AAssetManager *
lo_get_native_assetmgr(void)
{
- return native_asset_manager;
+ return native_asset_manager;
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */