summaryrefslogtreecommitdiff
path: root/sal/android
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2019-02-15 11:46:36 +0100
committerJan Holesovsky <kendy@collabora.com>2019-03-11 17:45:56 +0100
commitcb6d77987c614449a42162541ec3afa36a2959e7 (patch)
tree1b671ce3252299d832983ad5ebc6c4010403b940 /sal/android
parentf43483ce36b8a50ecc9266f26bc7b4ac302c6661 (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>
Diffstat (limited to 'sal/android')
-rw-r--r--sal/android/libreofficekit-jni.c29
1 files changed, 21 insertions, 8 deletions
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: */