[Libreoffice-commits] core.git: 2 commits - android/Bootstrap include/LibreOfficeKit sal/android
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Mar 11 16:46:20 UTC 2019
android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java | 18 ----
android/Bootstrap/version.map | 2
include/LibreOfficeKit/LibreOfficeKitInit.h | 4
sal/android/libreofficekit-jni.c | 42 ++++++++--
4 files changed, 38 insertions(+), 28 deletions(-)
New commits:
commit bd050920ffdeb694d0b4a8feaf72625626e851d7
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Feb 15 16:01:55 2019 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Mon Mar 11 17:46:09 2019 +0100
android: Set the FONTCONFIG_FILE envvar to the fonts.conf (if exists).
Change-Id: Ic9fd97a2ff8a6d96ffcc7ad300ef30201d786528
Reviewed-on: https://gerrit.libreoffice.org/67876
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java b/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java
index ce84b7409c1f..f6658d64806a 100644
--- a/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java
+++ b/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java
@@ -67,19 +67,6 @@ public final class LibreOfficeKit
String cacheDir = activity.getApplication().getCacheDir().getAbsolutePath();
String apkFile = activity.getApplication().getPackageResourcePath();
- // If there is a fonts.conf file in the apk that can be extracted, automatically
- // set the FONTCONFIG_FILE env var.
- InputStream inputStream;
- try {
- inputStream = activity.getAssets().open("unpack/etc/fonts/fonts.conf");
- } catch (java.io.IOException exception) {
- inputStream = null;
- }
-
- if (inputStream != null) {
- putenv("FONTCONFIG_FILE=" + dataDir + "/etc/fonts/fonts.conf");
- }
-
if (!initializeNative(dataDir, cacheDir, apkFile, mgr)) {
Log.e(LOGTAG, "Initialize native failed!");
return;
diff --git a/sal/android/libreofficekit-jni.c b/sal/android/libreofficekit-jni.c
index abbf3edaed10..c11f7dd4eb09 100644
--- a/sal/android/libreofficekit-jni.c
+++ b/sal/android/libreofficekit-jni.c
@@ -74,6 +74,9 @@ jboolean libreofficekit_initialize(JNIEnv* env,
const char *cacheDirPath;
const char *apkFilePath;
+ const char *fontsConf = "/etc/fonts/fonts.conf";
+ char *fontsConfPath;
+
setenv("OOO_DISABLE_RECOVERY", "1", 1);
native_asset_manager = AAssetManager_fromJava(env, assetManager);
@@ -89,6 +92,18 @@ jboolean libreofficekit_initialize(JNIEnv* env,
// TMPDIR is used by osl_getTempDirURL()
setenv("TMPDIR", cache_dir, 1);
+ fontsConfPath = malloc(strlen(data_dir) + sizeof(fontsConf));
+ strcpy(fontsConfPath, data_dir);
+ strcat(fontsConfPath, fontsConf);
+
+ fd = open(fontsConfPath, O_RDONLY);
+ if (fd != -1) {
+ close(fd);
+ LOGI("Setting FONTCONFIG_FILE to %s", fontsConfPath);
+ setenv("FONTCONFIG_FILE", fontsConfPath, 1);
+ }
+ free(fontsConfPath);
+
apkFilePath = (*env)->GetStringUTFChars(env, apkFile, NULL);
fd = open(apkFilePath, O_RDONLY);
commit cb6d77987c614449a42162541ec3afa36a2959e7
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Feb 15 11:46:36 2019 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Mon Mar 11 17:45:56 2019 +0100
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 at collabora.com>
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 5dbf2f83f988..c00c33193648 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -249,13 +249,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: */
More information about the Libreoffice-commits
mailing list