From 11c9125c28738ce99e502991523829756ec95326 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 11 Jan 2012 13:46:35 +0200 Subject: Work around http://code.google.com/p/android/issues/detail?id=23351 --- .../src/org/libreoffice/android/Bootstrap.java | 22 +++++++++++++++++++--- android/qa/sc/Makefile | 4 +++- 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'android') diff --git a/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java b/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java index 91f965e661d4..9cd9c3bcef82 100644 --- a/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java +++ b/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java @@ -37,6 +37,9 @@ import android.util.Log; import fi.iki.tml.CommandLine; +import java.io.File; +import java.util.Scanner; + // We override NativeActivity so that we can get at the intent of the // activity and its extra parameters, that we use to tell us what // actual LibreOffice "program" to run. I.e. something that on desktop @@ -111,9 +114,22 @@ public class Bootstrap extends NativeActivity // Get "command line" to pass to the LO "program" String cmdLine = getIntent().getStringExtra("lo-main-cmdline"); - if (cmdLine == null) - cmdLine = "/data/data/org.libreoffice.android/lib/libqa_sal_types.so"; - + if (cmdLine == null) { + String indirectFile = getIntent().getStringExtra("lo-main-indirect-cmdline"); + + if (indirectFile != null) { + try { + // Somewhat stupid but short way to read a file into a string + cmdLine = new Scanner(new File(indirectFile), "UTF-8").useDelimiter("\\A").next(); + } + catch (java.io.FileNotFoundException e) { + Log.i(TAG, String.format("Could not read %s: %s",indirectFile, e.toString())); + } + } + + if (cmdLine == null) + cmdLine = "/data/data/org.libreoffice.android/lib/libqa_sal_types.so"; + } // argv[0] will be replaced by android_main() in lo-bootstrap.c by the // pathname of the mainLibrary. cmdLine = "dummy-program-name " + cmdLine; diff --git a/android/qa/sc/Makefile b/android/qa/sc/Makefile index 450b7edeea43..c400c72ede5e 100644 --- a/android/qa/sc/Makefile +++ b/android/qa/sc/Makefile @@ -162,7 +162,9 @@ uninstall: adb uninstall $(APP_PACKAGE) run: - adb shell am start -n $(APP_PACKAGE)/$(BOOTSTRAP) -e lo-main-library libcppunittester -e lo-main-cmdline "$(APP_DATA_PATH)/lib/libtest_sc_ucalc.so --headless --protector libunoexceptionprotector.so unoexceptionprotector '-env:CONFIGURATION_LAYERS=xcsxcu:file:///assets/xml/registry' '-env:UNO_TYPES=file:///assets/bin/udkapi.rdb file:///assets/bin/types.rdb' '-env:UNO_SERVICES=file:///assets/xml/ure/services.rdb file:///assets/ComponentTarget/framework/util/fwk.component file:///assets/ComponentTarget/i18npool/util/i18npool.component file:///assets/ComponentTarget/sfx2/util/sfx.component file:///assets/ComponentTarget/unoxml/source/service/unoxml.component file:///assets/ComponentTarget/configmgr/source/configmgr.component file:///assets/xml/ucb1.component file:///assets/xml/ucpfile1.component' -env:URE_INTERNAL_LIB_DIR=file://$(APP_DATA_PATH)/lib -env:LO_LIB_DIR=file://$(APP_DATA_PATH)/lib" + echo "$(APP_DATA_PATH)/lib/libtest_sc_ucalc.so --headless --protector libunoexceptionprotector.so unoexceptionprotector '-env:CONFIGURATION_LAYERS=xcsxcu:file:///assets/xml/registry' '-env:UNO_TYPES=file:///assets/bin/udkapi.rdb file:///assets/bin/types.rdb' '-env:UNO_SERVICES=file:///assets/xml/ure/services.rdb file:///assets/ComponentTarget/framework/util/fwk.component file:///assets/ComponentTarget/i18npool/util/i18npool.component file:///assets/ComponentTarget/sfx2/util/sfx.component file:///assets/ComponentTarget/unoxml/source/service/unoxml.component file:///assets/ComponentTarget/configmgr/source/configmgr.component file:///assets/xml/ucb1.component file:///assets/xml/ucpfile1.component' -env:URE_INTERNAL_LIB_DIR=file://$(APP_DATA_PATH)/lib -env:LO_LIB_DIR=file://$(APP_DATA_PATH)/lib" >cmdline + adb push cmdline $(APP_DATA_PATH)/cmdline + adb shell am start -n $(APP_PACKAGE)/$(BOOTSTRAP) -e lo-main-library libcppunittester -e lo-main-indirect-cmdline "$(APP_DATA_PATH)/cmdline" clean: ant clean -- cgit