From 4d258787559426e1e2a0279888eb669622889899 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Sat, 15 Dec 2012 18:13:11 +0000 Subject: android: finally starting and rendering at least something again. Only renders on very-first-start after install (oddly). We initialize vcl in it's own thread to avoid problems. Thanks to tml for fixing a linking issue. Change-Id: I960d11c6098681356fea0634970545aa9af9bacb --- android/Bootstrap/Makefile.shared | 6 ++- android/Bootstrap/version.map | 2 +- android/qa/desktop/Makefile | 12 +++++ android/qa/desktop/native-code.cxx | 18 ++++++++ .../libreoffice/android/examples/LODesktop.java | 53 ++++++++++++++++------ 5 files changed, 74 insertions(+), 17 deletions(-) (limited to 'android') diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared index 3eb28a7117a4..1f1301367a97 100644 --- a/android/Bootstrap/Makefile.shared +++ b/android/Bootstrap/Makefile.shared @@ -88,11 +88,13 @@ WHOLELIBS = \ $(OBJLOCAL)/liblo-native-code.so : $(wildcard $(OUTDIR)/lib/lib*.a) native-code.cxx mkdir -p $(OBJLOCAL) - $(CXX) -Wl,-Map,liblo-native-code.map -Wl,--gc-sections -Wl,--version-script=../../Bootstrap/version.map -Wl,--no-keep-files-mapped -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -o $(OBJLOCAL)/liblo-native-code.so -I$(OUTDIR)/inc native-code.cxx -L$(OUTDIR)/lib $(WHOLELIBS) $(LIBS) -lgnustl_static -landroid -llog -lz + $(CXX) -Wl,-Map,liblo-native-code.map -Wl,--gc-sections -Wl,--version-script=../../Bootstrap/version.map -Wl,--no-keep-files-mapped -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -o $(OBJLOCAL)/liblo-native-code.so -I$(OUTDIR)/inc native-code.cxx -L$(OUTDIR)/lib $(WHOLELIBS) $(LIBS) -lgnustl_static -landroid -ljnigraphics -llog -lz $(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so mkdir -p $(SODEST) - $(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so + cp -a $(OBJLOCAL)/liblo-native-code.so $(SODEST)/liblo-native-code.so + +# shrinkme $(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so link-so: $(SODEST)/liblo-native-code.so diff --git a/android/Bootstrap/version.map b/android/Bootstrap/version.map index 1b65003eeaaa..e12d9985e78f 100644 --- a/android/Bootstrap/version.map +++ b/android/Bootstrap/version.map @@ -1,5 +1,5 @@ dummy { - global: + global: Java_*; JNI_OnLoad; local: diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index 685e584039ff..5ea6f3591933 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -128,6 +128,18 @@ copy-stuff: mkdir -p assets/presets/$$D ; \ echo "content" > assets/presets/$$D/stamp; \ done +# lofficerc + mkdir -p assets/program/ + 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 +# - this looks useful but breaks more than it fixes ... +# echo "DISABLE_EXTENSION_SYNCHRONIZATION=1" >> assets/program/lofficerc + setup-jars: # diff --git a/android/qa/desktop/native-code.cxx b/android/qa/desktop/native-code.cxx index 22c9a7e04ab7..4f54ccd65c16 100644 --- a/android/qa/desktop/native-code.cxx +++ b/android/qa/desktop/native-code.cxx @@ -13,6 +13,7 @@ extern "C" { extern void * animcore_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * avmedia_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); + extern void * cui_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * dba_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * dbaxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * evtatt_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); @@ -27,6 +28,7 @@ extern "C" extern void * lng_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * lnth_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * lotuswordpro_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); + extern void * protocolhandler_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * oox_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * sb_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * sc_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); @@ -36,14 +38,17 @@ extern "C" extern void * sdd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * sm_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * smd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); + extern void * spl_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * spell_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * svgfilter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * sw_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); + extern void * svx_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * swd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * t602filter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * textfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * unoxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * unordf_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); + extern void * uui_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * wpftdraw_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * wpftwriter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * xmlfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); @@ -62,6 +67,7 @@ lo_get_libmap(void) { "libavmedialo.a", avmedia_component_getFactory }, { "libdbalo.a", dba_component_getFactory }, { "libdbaxmllo.a", dbaxml_component_getFactory }, + { "libcuilo.a", cui_component_getFactory }, { "libevtattlo.a", evtatt_component_getFactory }, { "libfileacc.a", fileacc_component_getFactory }, { "libfrmlo.a", frm_component_getFactory }, @@ -75,6 +81,7 @@ lo_get_libmap(void) { "liblnthlo.a", lnth_component_getFactory }, { "liblwpftlo.a", lotuswordpro_component_getFactory }, { "libooxlo.a", oox_component_getFactory }, + { "libprotocolhandlerlo.a", protocolhandler_component_getFactory }, { "libscdlo.a", scd_component_getFactory }, { "libscfiltlo.a", scfilt_component_getFactory }, { "libsblo.a", sb_component_getFactory }, @@ -83,13 +90,16 @@ lo_get_libmap(void) { "libsdlo.a", sd_component_getFactory }, { "libsmdlo.a", smd_component_getFactory }, { "libsmlo.a", sm_component_getFactory }, + { "libspllo.a", spl_component_getFactory }, { "libsvgfilterlo.a", svgfilter_component_getFactory }, + { "libsvxlo.a", svx_component_getFactory }, { "libswdlo.a", swd_component_getFactory }, { "libswlo.a", sw_component_getFactory }, { "libt602filterlo.a", t602filter_component_getFactory }, { "libtextfdlo.a", textfd_component_getFactory }, { "libunordflo.a", unordf_component_getFactory }, { "libunoxmllo.a", unoxml_component_getFactory }, + { "libuuilo.a", uui_component_getFactory }, { "libwpftdrawlo.a", wpftdraw_component_getFactory }, { "libwpftwriterlo.a", wpftwriter_component_getFactory }, { "libxmlfdlo.a", xmlfd_component_getFactory }, @@ -99,6 +109,14 @@ lo_get_libmap(void) { NULL, NULL } }; + // We need to pull this in, too, as it isn't in any of the libs we + // link with -Wl,--whole-archive. + extern void Java_org_libreoffice_android_examples_LODesktop_spawnMain(); + volatile void *p = (void *) Java_org_libreoffice_android_examples_LODesktop_spawnMain; + + extern void Java_org_libreoffice_android_examples_LODesktop_renderVCL(); + volatile void *q = (void *) Java_org_libreoffice_android_examples_LODesktop_renderVCL; + return map; } diff --git a/android/qa/desktop/src/org/libreoffice/android/examples/LODesktop.java b/android/qa/desktop/src/org/libreoffice/android/examples/LODesktop.java index 5891cea3ee0c..bf370e6e36cd 100644 --- a/android/qa/desktop/src/org/libreoffice/android/examples/LODesktop.java +++ b/android/qa/desktop/src/org/libreoffice/android/examples/LODesktop.java @@ -58,6 +58,7 @@ package org.libreoffice.android.examples; import android.app.Activity; import android.app.AlertDialog; +import android.content.Context; import android.content.DialogInterface; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -121,6 +122,12 @@ public class LODesktop { private static final String TAG = "LODesktop"; + /* implementend by desktop */ + private static native void spawnMain(); + + /* implementend by vcl */ + public static native void renderVCL(Bitmap bitmap); + /** * This class contains the state that is initialized once and never changes * (not specific to a document or a view). @@ -233,17 +240,6 @@ public class LODesktop bootstrapContext.mcf = bootstrapContext.componentContext.getServiceManager(); Log.i(TAG, "mcf is" + (bootstrapContext.mcf!=null ? " not" : "") + " null"); - - Bootstrap.initVCL(); - - Object desktop = bootstrapContext.mcf.createInstanceWithContext - ("com.sun.star.frame.Desktop", bootstrapContext.componentContext); - - Log.i(TAG, "desktop is" + (desktop!=null ? " not" : "") + " null"); - - bootstrapContext.componentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop); - - Log.i(TAG, "componentLoader is" + (bootstrapContext.componentLoader!=null ? " not" : "") + " null"); } catch (Exception e) { @@ -260,9 +256,11 @@ public class LODesktop Log.i(TAG, "onCreate - added here\n"); try { - String input = getIntent().getStringExtra("input"); - if (input == null) - input = "/assets/test1.odt"; + String input; +// input = getIntent().getStringExtra("input"); +// if (input == null) +// input = "/assets/test1.odt"; + input = "-writer"; // We need to fake up an argv, and the argv[0] even needs to // point to some file name that we can pretend is the "program". @@ -276,12 +274,39 @@ public class LODesktop if (bootstrapContext == null) initBootstrapContext(); + spawnMain(); } catch (Exception e) { e.printStackTrace(System.err); finish(); } + + Log.i(TAG, "onCreate - set content view\n"); + setContentView(new BitmapView(this, this)); } } + class BitmapView extends android.view.View + { + LODesktop mDesktop; + Bitmap mBitmap; + + public BitmapView(Context context, LODesktop desktop) + { + super(context); + mDesktop = desktop; + mBitmap = Bitmap.createBitmap(1000, 600, Bitmap.Config.ARGB_8888); + } + + @Override protected void onDraw(Canvas canvas) { +// canvas.drawColor(0xFF1ABCDD); + + mDesktop.renderVCL(mBitmap); + canvas.drawBitmap(mBitmap, 0, 0, null); + + // re-call ourselves a bit later ... + invalidate(); + } + } + // vim:set shiftwidth=4 softtabstop=4 expandtab: -- cgit