android/experiments/DocumentLoader/Makefile | 36 +++++++--- android/experiments/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java | 3 bridges/source/jni_uno/jni_data.cxx | 21 +++++ bridges/source/jni_uno/jni_info.cxx | 5 + bridges/source/jni_uno/jni_info.h | 2 sal/osl/unx/file.cxx | 2 sal/rtl/source/bootstrap.cxx | 8 +- 7 files changed, 66 insertions(+), 11 deletions(-)
New commits: commit d770275587f8c48b9ca1ae3905b296cf3dffe3b3 Author: Tor Lillqvist <tlillqv...@suse.com> Date: Mon Mar 26 17:52:25 2012 +0300 More hacking diff --git a/android/experiments/DocumentLoader/Makefile b/android/experiments/DocumentLoader/Makefile index 0c31954..7aa3264 100644 --- a/android/experiments/DocumentLoader/Makefile +++ b/android/experiments/DocumentLoader/Makefile @@ -112,6 +112,14 @@ copy-stuff: # # Then other "assets". Let the directory structure under assets mimic # that under solver for now. +# +# Please note that I have no idea what all of this is really necessary and for +# much of this stuff being copied, no idea whether it makes any sense at all. +# Much of this is copy-pasted from android/qa/sc/Makefile (where a couple of +# unit tests for sc are built, and those do seem to mostly work) and +# android/qa/desktop/Makefile (mmeeks's desktop demo, also works to some +# extent). +# mkdir -p assets/bin/ure assets/lib assets/program assets/xml/ure assets/ComponentTarget/i18npool/util cp $(OUTDIR)/bin/udkapi.rdb assets/bin cp $(OUTDIR)/bin/types.rdb assets/bin @@ -124,14 +132,24 @@ copy-stuff: cp $(SRC_ROOT)/odk/examples/java/DocumentHandling/test/test1.odt assets cp $(WORKDIR)/ComponentTarget/i18npool/util/i18npool.component assets/ComponentTarget/i18npool/util # -# Set up lofficerc, the "inifile" (see soffice_main()) - echo '[Bootstrap]' > assets/program/lofficerc - echo 'Logo=1' >> assets/program/lofficerc - echo 'NativeProgress=1' >> assets/program/lofficerc - echo 'URE_BOOTSTRAP=file:///assets/program/fundamentalrc' >> assets/program/lofficerc -# echo 'RTL_LOGFILE=file:///dev/log/main' >> assets/program/lofficerc - echo "HOME=$(APP_DATA_PATH)/files" >> assets/program/lofficerc - echo "OSL_SOCKET_PATH=$(APP_DATA_PATH)/files" >> assets/program/lofficerc + mkdir -p assets/ure/share/misc assets/share/registry/res assets/share/config/soffice.cfg + cp -R $(OUTDIR)/xml/*.xcd assets/share/registry + mv assets/share/registry/fcfg_langpack_en-US.xcd assets/share/registry/res + cp -R $(OUTDIR)/xml/uiconfig/* assets/share/config/soffice.cfg + cp -R $(OUTDIR)/xml/registry/* assets/share/registry +# +# Set up rc, the "inifile". See BootstrapMap::getBaseIni(). As this app +# doesn't use soffice_main() (at least I think it shouldn't), the +# rtl::Bootstrap::setIniFilename() call there that hardcodes +# /assets/program/lofficerc isn't executed. Instead the hardcoding of +# /assets/rc in BootstrapMap::getBaseIni() gets used. + echo '[Bootstrap]' > assets/rc + echo 'Logo=1' >> assets/rc + echo 'NativeProgress=1' >> assets/rc + echo 'URE_BOOTSTRAP=file:///assets/program/fundamentalrc' >> assets/rc +# echo 'RTL_LOGFILE=file:///dev/log/main' >> assets/rc + echo "HOME=$(APP_DATA_PATH)/cache" >> assets/rc + echo "OSL_SOCKET_PATH=$(APP_DATA_PATH)/cache" >> assets/rc # # Set up fundamentalrc echo '[Bootstrap]' > assets/program/fundamentalrc @@ -151,7 +169,7 @@ copy-stuff: echo '[Bootstrap]' > assets/program/bootstraprc echo 'InstallMode=<installmode>' >> assets/program/bootstraprc echo 'ProductKey=LibreOffice 3.6' >> assets/program/bootstraprc - echo "UserInstallation=file://$(APP_DATA_PATH)/files/.libreoffice" >> assets/program/bootstraprc + echo "UserInstallation=file://$(APP_DATA_PATH)/cache/.libreoffice" >> assets/program/bootstraprc # Set up versionrc echo '[Version]' > assets/program/versionrc diff --git a/android/experiments/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java b/android/experiments/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java index f1e6ed5..882c73c 100644 --- a/android/experiments/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java +++ b/android/experiments/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java @@ -50,9 +50,12 @@ public class DocumentLoader Bootstrap.setup(this); + Bootstrap.putenv("SAL_LOG=yes"); + // Load a lot of shlibs here explicitly in advance because that // makes debugging work better, sigh Bootstrap.dlopen("libvcllo.so"); + Bootstrap.dlopen("libmergedlo.so"); com.sun.star.uno.XComponentContext xContext = null; commit 10f5ab71a71ec8683e18d37b3b325beff9a5fd6a Author: Tor Lillqvist <tlillqv...@suse.com> Date: Mon Mar 26 17:51:45 2012 +0300 Hardcode default inifile as /assets/rc on Android diff --git a/sal/rtl/source/bootstrap.cxx b/sal/rtl/source/bootstrap.cxx index dc8d02d..a62f3f3 100644 --- a/sal/rtl/source/bootstrap.cxx +++ b/sal/rtl/source/bootstrap.cxx @@ -396,7 +396,7 @@ Bootstrap_Impl * BootstrapMap::getBaseIni() { if (baseIni_ == 0) { rtl::OUString uri; if (baseIniUri_.isEmpty()) { -#ifdef IOS +#if defined IOS // On iOS hardcode the inifile as "rc" in the .app // directory. Apps are self-contained anyway, there is no // possibility to have several "applications" in the same @@ -404,6 +404,12 @@ Bootstrap_Impl * BootstrapMap::getBaseIni() { const char *inifile = [[@"vnd.sun.star.pathname:" stringByAppendingString: [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent: @"rc"]] UTF8String]; uri = rtl::OUString(inifile, strlen(inifile), RTL_TEXTENCODING_UTF8); resolvePathnameUrl(&uri); +#elif defined ANDROID + // Apps are self-contained on Android, too, can as well hardcode + // it as "rc" in the "/assets" directory, i.e. inside the app's + // .apk (zip) archive as the /assets/rc file. + uri = rtl::OUString("vnd.sun.star.pathname:/assets/rc"); + resolvePathnameUrl(&uri); #else if (CommandLineParameters::get().get( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INIFILENAME")), commit e56c5b511c84a032baecc6c67bb90f13646e939d Author: Tor Lillqvist <tlillqv...@suse.com> Date: Mon Mar 26 17:50:52 2012 +0300 Add an OSL_TRACE when opening Android /assets files diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index c513f60..5e59f7c 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -907,6 +907,8 @@ SAL_CALL osl_openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_u void *address; size_t size; address = lo_apkentry(cpFilePath, &size); + OSL_TRACE("osl_openFile(%s): %p", + cpFilePath, address); if (address == NULL) { errno = ENOENT; commit b5ca34fa409bc4cbeb41a84b900612e302f5b0fb Author: Tor Lillqvist <tlillqv...@suse.com> Date: Mon Mar 26 17:45:52 2012 +0300 Field IDs on Dalvik are more unique than in JVMs diff --git a/bridges/source/jni_uno/jni_data.cxx b/bridges/source/jni_uno/jni_data.cxx index 9d77812..cabca76 100644 --- a/bridges/source/jni_uno/jni_data.cxx +++ b/bridges/source/jni_uno/jni_data.cxx @@ -1968,7 +1968,26 @@ void Bridge::map_to_java( comp_td)->pParameterizedTypes != 0; for ( sal_Int32 nPos = comp_td->nMembers; nPos--; ) { - jfieldID field_id = linfo->m_fields[ nPos ]; + jfieldID field_id; + + // Handle com.sun.star.uno.RuntimeException::Context as a + // special case. In (C++) UNO css::uno::RuntimeException + // is simply a subclass of css::uno::Exception, which + // contains the Context field. In the Java UNO mapping + // css.uno.RuntimeException is a subclass of + // java.lang.RuntimeException, and has a Context field of + // its own, separate from that of css.uno.Exception. + + // In Dalvik the field IDs of these Context fields + // differ. (In Java VMs they seem to be the same.) + + if (type_equals( comp_info->m_td.get()->pWeakRef, + m_jni_info->m_RuntimeException_type.getTypeLibType() ) + && nPos == 1) + field_id = m_jni_info->m_field_css_uno_RuntimeException_m_Context; + else + field_id = linfo->m_fields[ nPos ]; + if (0 != field_id) { void const * p = diff --git a/bridges/source/jni_uno/jni_info.cxx b/bridges/source/jni_uno/jni_info.cxx index a5ed28a..1d601cf 100644 --- a/bridges/source/jni_uno/jni_info.cxx +++ b/bridges/source/jni_uno/jni_info.cxx @@ -762,6 +762,11 @@ JNI_info::JNI_info( jni.ensure_no_exception(); OSL_ASSERT( 0 != m_field_JNI_proxy_m_oid ); + m_field_css_uno_RuntimeException_m_Context = jni->GetFieldID( + (jclass) jo_RuntimeException.get(), "Context", "Ljava/lang/Object;" ); + jni.ensure_no_exception(); + OSL_ASSERT( 0 != m_field_css_uno_RuntimeException_m_Context ); + // get java env OUString java_env_type_name( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_JAVA) ); JLocalAutoRef jo_java( diff --git a/bridges/source/jni_uno/jni_info.h b/bridges/source/jni_uno/jni_info.h index a356be2..9cdbbf4 100644 --- a/bridges/source/jni_uno/jni_info.h +++ b/bridges/source/jni_uno/jni_info.h @@ -204,6 +204,8 @@ public: jfieldID m_field_JNI_proxy_m_type; jfieldID m_field_JNI_proxy_m_oid; + jfieldID m_field_css_uno_RuntimeException_m_Context; + // ::com::sun::star::uno::TypeDescription m_XInterface_queryInterface_td; ::com::sun::star::uno::Type const & m_Exception_type; _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits