blob: 076dff22f035b389fd3d2e96e0e41367271dd67e [file] [log] [blame]
Tor Lillqvista9d167b2011-11-11 16:44:18 +02001Android-specific notes
2
3Unit tests are the first thing we want to run on Android, to get some
4idea how well, if at all, the basic LO libraraies work. We want to
5build even unit tests as normal Android apps, i.e. packaged as .apk
6files, so that they run in a sandboxed environment like that of
7whatever eventual end-user Android apps there will be that use LO
8code.
9
10Sure, we could quite easily build unit tests as plain Android
11executables, push them to the device or emulator with adb and run them
12from adb shell, but that would not be a good test as the environment
13would be completely different. They would run as root, and not
14sandboxed. We have no intent to require LibreOffice code to be used
15only on "rooted" devices etc.
16
17All Android apps are basically Java programs. They run "in" a Dalvik
18virtual machine. Yes, you can also have apps where your code is only
19native code, written in a compiled language like C or C++. But also
20also such apps are actually started by system-provided Java
21bootstrapping code (NativeActivity) running in a Dalvik VM.
22
23Such a native app (or actually, "activity") is not built as a
24executable program, but as a shared object. The Java NativeActivity
25bootstrapper loads that shared object with dlopen.
26
27It is somewhat problematic to construct .apk packages except by using
28the high-level tools in the Android SDK. At least I haven't figured
29out how to manually construct an .apk that is properly signed so that
30it will run in the emulator. (I don't have any Android device...) I
31only know how to let the SDK Ant tooling do it...
32
33A LO Android app would work would something like this:
34
35We have a top Java bootstrapping class
36org.libreoffice.android.Bootstrap that loads a small helper native
37library liblo-bootstrap.so that implements JNI wrappers for dlopen(),
38dlsym(), and ELF header scanning coresponding to looking for DT_NEEDED
39entries with readelf.
40
41The Java code then loads the actual native library that corresponds to
42the LibreOffice-related "program" we want to run. For unit tests, a
43library that corresponds to cppunittester program. Then through helper
44functions in liblo-bootstrap it calls a named function in that
45"program".
46
Tor Lillqvist172b1f02011-12-01 16:08:44 +020047This Android-specific native code (the lo-bootstrap library) is for
48now in sal/android, and the Java code in the android "module"
49(subdirectory right here).
Tor Lillqvista9d167b2011-11-11 16:44:18 +020050
51--Tor Lillqvist <tml@iki.fi>