Kaydet (Commit) c72d300b authored tarafından Jan Holesovsky's avatar Jan Holesovsky

android: Make the extract_files() part of setup / init.

We need to have the files extracted before we attempt to initialize
LibreOfficeKit (call libreofficekit_hook), otherwise the .rdb's are not there.

Change-Id: Ib49db7e945a709d18a063eb488a27df18fef542b
üst db89e5ff
...@@ -37,9 +37,6 @@ public final class Bootstrap ...@@ -37,9 +37,6 @@ public final class Bootstrap
String cacheDir, String cacheDir,
String apkFile); String apkFile);
// Extracts files in the .apk that need to be extraced into the app's tree
static native void extract_files();
// Wrapper for getpid() // Wrapper for getpid()
public static native int getpid(); public static native int getpid();
...@@ -101,9 +98,6 @@ public final class Bootstrap ...@@ -101,9 +98,6 @@ public final class Bootstrap
activity.getApplication().getPackageResourcePath())) activity.getApplication().getPackageResourcePath()))
return; return;
// 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 // If we notice that a fonts.conf file was extracted, automatically
// set the FONTCONFIG_FILE env var. // set the FONTCONFIG_FILE env var.
InputStream i; InputStream i;
......
...@@ -26,7 +26,7 @@ public final class LibreOfficeKit ...@@ -26,7 +26,7 @@ public final class LibreOfficeKit
{ {
} }
private static String TAG = "lo-bootstrap"; private static String TAG = "LibreOfficeKit";
// Native methods in this class are all implemented in // Native methods in this class are all implemented in
// sal/android/lo-bootstrap.c as the lo-bootstrap library is loaded with // sal/android/lo-bootstrap.c as the lo-bootstrap library is loaded with
...@@ -37,9 +37,6 @@ public final class LibreOfficeKit ...@@ -37,9 +37,6 @@ public final class LibreOfficeKit
String cacheDir, String cacheDir,
String apkFile); String apkFile);
// Extracts files in the .apk that need to be extraced into the app's tree
static native void extract_files();
/* /*
// Wrapper for getpid() // Wrapper for getpid()
public static native int getpid(); public static native int getpid();
...@@ -92,7 +89,7 @@ public final class LibreOfficeKit ...@@ -92,7 +89,7 @@ public final class LibreOfficeKit
ApplicationInfo ai = activity.getApplicationInfo(); ApplicationInfo ai = activity.getApplicationInfo();
dataDir = ai.dataDir; dataDir = ai.dataDir;
Log.i(TAG, String.format("dataDir=%s\n", dataDir)); Log.i(TAG, String.format("Initializing LibreOfficeKit, dataDir=%s\n", dataDir));
redirect_stdio(true); redirect_stdio(true);
...@@ -101,9 +98,6 @@ public final class LibreOfficeKit ...@@ -101,9 +98,6 @@ public final class LibreOfficeKit
activity.getApplication().getPackageResourcePath())) activity.getApplication().getPackageResourcePath()))
return; return;
// 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 // If we notice that a fonts.conf file was extracted, automatically
// set the FONTCONFIG_FILE env var. // set the FONTCONFIG_FILE env var.
InputStream i; InputStream i;
......
...@@ -37,7 +37,6 @@ extern int apk_file_size; ...@@ -37,7 +37,6 @@ extern int apk_file_size;
extern void Java_org_libreoffice_android_Bootstrap_putenv(JNIEnv* env, jobject clazz, jstring string); extern void Java_org_libreoffice_android_Bootstrap_putenv(JNIEnv* env, jobject clazz, jstring string);
extern void Java_org_libreoffice_android_Bootstrap_redirect_1stdio(JNIEnv* env, jobject clazz, jboolean state); extern void Java_org_libreoffice_android_Bootstrap_redirect_1stdio(JNIEnv* env, jobject clazz, jboolean state);
extern void Java_org_libreoffice_android_Bootstrap_extract_1files(JNIEnv* env, jobject clazz);
extern LibreOfficeKit *libreofficekit_hook(const char* install_path); extern LibreOfficeKit *libreofficekit_hook(const char* install_path);
...@@ -63,15 +62,6 @@ Java_org_libreoffice_android_LibreOfficeKit_redirect_1stdio(JNIEnv* env, ...@@ -63,15 +62,6 @@ Java_org_libreoffice_android_LibreOfficeKit_redirect_1stdio(JNIEnv* env,
Java_org_libreoffice_android_Bootstrap_redirect_1stdio(env, clazz, state); Java_org_libreoffice_android_Bootstrap_redirect_1stdio(env, clazz, state);
} }
/// Call the same method from Bootstrap.
__attribute__ ((visibility("default")))
void
Java_org_libreoffice_android_LibreOfficeKit_extract_1files(JNIEnv* env,
jobject clazz)
{
Java_org_libreoffice_android_Bootstrap_extract_1files(env, clazz);
}
/// Initialize the LibreOfficeKit. /// Initialize the LibreOfficeKit.
__attribute__ ((visibility("default"))) __attribute__ ((visibility("default")))
jboolean jboolean
...@@ -136,6 +126,11 @@ Java_org_libreoffice_android_LibreOfficeKit_init__Ljava_lang_String_2Ljava_lang_ ...@@ -136,6 +126,11 @@ Java_org_libreoffice_android_LibreOfficeKit_init__Ljava_lang_String_2Ljava_lang_
return JNI_FALSE; return JNI_FALSE;
} }
// Extract files from the .apk that can't be used mmapped directly from it
extract_files(UNPACK_TREE, UNPACK_TREE, 0);
extract_files(UNPACK_TREE_GZ, UNPACK_TREE_GZ, 1);
// Initialize LibreOfficeKit
pOffice = libreofficekit_hook(data_dir); pOffice = libreofficekit_hook(data_dir);
if (!pOffice) if (!pOffice)
{ {
......
...@@ -311,6 +311,10 @@ Java_org_libreoffice_android_Bootstrap_setup__Ljava_lang_String_2Ljava_lang_Stri ...@@ -311,6 +311,10 @@ Java_org_libreoffice_android_Bootstrap_setup__Ljava_lang_String_2Ljava_lang_Stri
if (!setup_assets_tree()) if (!setup_assets_tree())
return JNI_FALSE; return JNI_FALSE;
// Extract files from the .apk that can't be used mmapped directly from it
extract_files(UNPACK_TREE, UNPACK_TREE, 0);
extract_files(UNPACK_TREE_GZ, UNPACK_TREE_GZ, 1);
return JNI_TRUE; return JNI_TRUE;
} }
...@@ -807,20 +811,6 @@ extract_files(const char *root, ...@@ -807,20 +811,6 @@ extract_files(const char *root,
lo_apk_closedir(tree); lo_apk_closedir(tree);
} }
// 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, UNPACK_TREE, 0);
extract_files(UNPACK_TREE_GZ, UNPACK_TREE_GZ, 1);
}
/* Android's JNI works only to libraries loaded through Java's /* Android's JNI works only to libraries loaded through Java's
* System.loadLibrary(), it seems. But now with just one big app-specific .so * System.loadLibrary(), it seems. But now with just one big app-specific .so
* on Android, that would not be a problem, but for historical reasons, we * on Android, that would not be a problem, but for historical reasons, we
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment