Kaydet (Commit) 3e425dfa authored tarafından Tor Lillqvist's avatar Tor Lillqvist

More Android hacking

üst 58142299
......@@ -3,6 +3,19 @@ include ../../../config_host.mk
# The package of this app
APP_PACKAGE=org.libreoffice.android.examples
# We can't keep assuming APP_DATA_PATH like this, surely this can vary with
# Android versions and whatnot, this is temporary and works at least with the
# SDK 16 emulator...
# Probably would be best to just stop fooling around with the possibilities to
# set various stuff with the -env command line parameters (and environment
# variables?) and in a plethora of rc files, and hardcode construction of
# *all* required pathnames based on the app installation location for Android
# (and iOS), etc. We don't really win anything by having so many layers of
# configurability on platforms like Android and iOS where apps based on LO
# code are very much self-contained pre-packaged thingies.
APP_DATA_PATH=/data/data/$(APP_PACKAGE)
SODEST=libs/armeabi-v7a
OBJLOCAL=obj/local/armeabi-v7a
......@@ -31,32 +44,65 @@ copy-stuff:
# them.
#
for F in $(strip \
analysislo \
basebmplo \
basegfxlo \
bootstrap.uno \
comphelpgcc3 \
datelo \
expwrap.uno \
fastsax.uno \
fileacc \
fontconfig \
forlo \
foruilo \
freetype \
frmlo \
gcc3_uno \
i18nisolang1gcc3 \
i18npaperlo \
i18npool.uno \
i18nutilgcc3 \
icudatalo \
icui18nlo \
iculelo \
icuuclo \
introspection.uno \
java_uno \
juh \
juhx \
jvmaccessgcc3 \
jvmfwk \
lo-bootstrap \
localedata_en \
localedata_others \
mergedlo \
msfilterlo \
ooxlo \
reflection.uno \
reg \
saxlo \
sclo \
scfiltlo \
sotlo \
stocservices.uno \
store \
svllo \
textinstream.uno \
tllo \
ucbhelper4gcc3 \
uno_cppu \
uno_cppuhelpergcc3 \
uno_sal \
uno_salhelpergcc3 \
uno_cppuhelpergcc3 \
unoxmllo \
utllo \
vbahelperlo \
vcllo \
xml2 \
xmlreader \
bootstrap.uno \
i18npool.uno \
xstor \
); do \
$(call COPYSO,$(OUTDIR)/lib/lib$${F}.so); \
done
......@@ -66,14 +112,58 @@ copy-stuff:
#
# Then other "assets". Let the directory structure under assets mimic
# that under solver for now.
mkdir -p assets/bin assets/lib assets/xml/ure assets/ComponentTarget/i18npool/util
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
cp $(OUTDIR)/bin/uno.ini assets
cp $(OUTDIR)/xml/ure/services.rdb assets/xml/ure
cp $(OUTDIR)/bin/ure/types.rdb assets/bin/ure
# For some reason the vnd.sun.star.expand:$LO_LIB_DIR doesn't seem to work, it expands to empty!?
# So just hardcode the known APP_DATA_PATH for now...
for F in xml/services xml/ure/services; do \
sed -e 's!uri="vnd.sun.star.expand:$$LO_LIB_DIR/!uri="file://$(APP_DATA_PATH)/lib/!g' <$(OUTDIR)/$$F.rdb >assets/$$F.rdb; \
done
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
#
# Set up fundamentalrc
echo '[Bootstrap]' > assets/program/fundamentalrc
echo "LO_LIB_DIR=file:$(APP_DATA_PATH)/lib/" >> assets/program/fundamentalrc
echo "URE_LIB_DIR=file://$(APP_DATA_PATH)/lib/" >> assets/program/fundamentalrc # checkme - is this used to find configs ?
echo 'BRAND_BASE_DIR=file:///assets' >> assets/program/fundamentalrc
echo 'CONFIGURATION_LAYERS=xcsxcu:$${BRAND_BASE_DIR}/share/registry module:$${BRAND_BASE_DIR}/share/registry/modules res:$${BRAND_BASE_DIR}/share/registry user:$${$$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/user/registrymodifications.xcu' >> assets/program/fundamentalrc
echo 'URE_BIN_DIR=file:///assets/ure/bin/dir/not-here/can-we/exec-anyway' >> assets/program/fundamentalrc
echo 'URE_MORE_TYPES=file:///assets/bin/ure/types.rdb file:///assets/bin/types.rdb' >> assets/program/fundamentalrc
echo 'URE_MORE_SERVICES=file:///assets/xml/ure/services.rdb file:///assets/xml/services.rdb <$$BRAND_BASE_DIR/program/services>*' >> assets/program/fundamentalrc
# Set up unorc
echo '[Bootstrap]' > assets/program/unorc
echo "URE_INTERNAL_LIB_DIR=file://$(APP_DATA_PATH)/lib/" >> assets/program/unorc
echo 'UNO_TYPES=file:///assets/bin/ure/types.rdb file:///assets/bin/types.rdb $${URE_MORE_TYPES}' >> assets/program/unorc
echo 'UNO_SERVICES=file:///assets/xml/ure/services.rdb file:///assets/xml/services.rdb $${URE_MORE_SERVICES}' >> assets/program/unorc
# Set up bootstraprc
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
# Set up versionrc
echo '[Version]' > assets/program/versionrc
echo 'AllLanguages=en-US' >> assets/program/versionrc
echo 'BuildVersion=' >> assets/program/versionrc
echo 'buildid=dead-beef' >> assets/program/versionrc
echo 'ProductBuildid=3' >> assets/program/versionrc
echo 'ProductMajor=360' >> assets/program/versionrc
echo 'ProductMinor=1' >> assets/program/versionrc
echo 'ProductSource=OOO350' >> assets/program/versionrc
echo 'ReferenceOOoMajorMinor=3.6' >> assets/program/versionrc
#
# Then gdbserver and gdb.setup so that we can debug with ndk-gdb.
#
cp $(ANDROID_NDK_HOME)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver $(SODEST)
......@@ -105,7 +195,7 @@ build-ant: copy-stuff
#
unset JAVA_HOME && $(ANT) debug
install: copy-stuff
install: build-ant
unset JAVA_HOME && $(ANT) debug install
@echo
@echo 'Run it with something like what "make run" does (see Makefile)'
......
# Needed just to satisfy ndk-gdb for now, but maybe later we will actually add
# some JNI code here
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include $(BUILD_SHARED_LIBRARY)
# File needed by ndk-gdb
APP_ABI := armeabi-v7a
APP_PLATFORM := android-14
......@@ -50,30 +50,39 @@ public class DocumentLoader
Bootstrap.setup(this);
Bootstrap.dlopen("libjuh.so");
// Load more shlibs here explicitly in advance because
// that makes debugging work better, sigh
Bootstrap.dlopen("libuno_cppu.so");
Bootstrap.dlopen("libuno_salhelpergcc3.so");
Bootstrap.dlopen("libuno_cppuhelpergcc3.so");
Bootstrap.dlopen("libbootstrap.uno.so");
Bootstrap.dlopen("libgcc3_uno.so");
Bootstrap.dlopen("libjava_uno.so");
// Load a lot of shlibs here explicitly in advance because that
// makes debugging work better, sigh
Bootstrap.dlopen("libvcllo.so");
Bootstrap.putenv("UNO_TYPES=file:///assets/bin/udkapi.rdb file:///assets/bin/types.rdb");
Bootstrap.putenv("UNO_SERVICES=file:///assets/xml/ure/services.rdb");
// Bootstrap.putenv("INIFILENAME=vnd.sun.star.pathname:/assets/uno.ini");
com.sun.star.uno.XComponentContext xContext = null;
xContext = com.sun.star.comp.helper.Bootstrap.defaultBootstrap_InitialComponentContext();
Log.i(TAG, "xContext is" + (xContext!=null ? " not" : "") + " null");
Log.i(TAG, "Sleeping NOW");
Thread.sleep(20000);
com.sun.star.lang.XMultiComponentFactory xMCF =
xContext.getServiceManager();
Log.i(TAG, "xMCF is" + (xMCF!=null ? " not" : "") + " null");
String input = getIntent().getStringExtra("input");
if (input == null)
input = "/assets/test1.odt";
// We need to fake up abn argv, and the argv[0] even needs to
// point to some file name that we can pretend is the "program".
// setCommandArgs() will prefix argv[0] with the app's data
// directory.
String[] argv = { "lo-document-loader", input };
Bootstrap.setCommandArgs(argv);
Bootstrap.initVCL();
Object oDesktop = xMCF.createInstanceWithContext(
"com.sun.star.frame.Desktop", xContext);
......@@ -86,12 +95,6 @@ public class DocumentLoader
Log.i(TAG, "xCompLoader is" + (xCompLoader!=null ? " not" : "") + " null");
String input = getIntent().getStringExtra("input");
if (input == null)
input = "/assets/test1.odt";
String sUrl = "file://" + input;
// Loading the wanted document
com.sun.star.beans.PropertyValue propertyValues[] =
new com.sun.star.beans.PropertyValue[1];
......@@ -99,6 +102,8 @@ public class DocumentLoader
propertyValues[0].Name = "Hidden";
propertyValues[0].Value = new Boolean(true);
String sUrl = "file://" + input;
Object oDoc =
xCompLoader.loadComponentFromURL
(sUrl, "_blank", 0, propertyValues);
......
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