summaryrefslogtreecommitdiff
path: root/sal/android/libreofficekit-jni.c
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 /sal/android/libreofficekit-jni.c
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>
Diffstat (limited to 'sal/android/libreofficekit-jni.c')
-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: */