Files
strongswan-ext/src/frontends/android
Tobias Brunner 51f746161d android: Add workaround for a bug preventing background service starts from TileService
When targeting Android 14, we get a "Background activity launch blocked!"
exception when trying to start the connection in the background (closing
the drawer works).  Which is apparently a bug:

  https://issuetracker.google.com/issues/305035828

The workaround here is kinda ugly.  In particular, because it's not
possible anymore since a few versions to open a dialog that allows users
to directly grant the required permission to the app.  We can only open
the generic settings dialog where users have to search for the app and
grant the permission themselves (we could add a dialog with an explanation
similar to the one for the power whitelist if necessary).  Hopefully this
gets fixed at some point (the current beta of Android 15 still has the
same bug, though).
2024-08-06 18:01:54 +02:00
..
2024-08-06 18:01:54 +02:00

To build this within the NDK the following things have to be done:

 - By default, the strongSwan sources of the current Git tree are used. They
   have to be prepared first (see HACKING for a list of required tools):

     ./autogen.sh && ./configure && make && make distclean

   It's also possible to use the sources from a different directory (e.g. an
   extracted tarball) by setting strongswan_DIR in app/src/main/jni/Android.mk.

 - The libstrongswan library depends on an Android module called libcrypto_static
   that provides OpenSSL's libcrypto and header files.  To simplify this, the
   build.sh script in the openssl directory can be used to statically build
   libcrypto for all ABIs. The results are placed in app/src/main/jni/openssl.

   The script expects the path to the Android NDK in ANDROID_NDK_ROOT, which is
   something like /path/to/android-ndk-<ver> for standalone NDKs, and something
   like /path/to/android-sdk/ndk/<ver> for side-by-side NDKs.  The path to the
   OpenSSL sources is expected in OPENSSL_SRC (work with OpenSSL 1.1.1 or 3).
   For instance, it may be invoked like this:

     ANDROID_NDK_ROOT=~/android-ndk-<ver> \
     OPENSSL_SRC=~/openssl-<ver> \
     src/frontends/android/openssl/build.sh

   By default, the script uses Docker to compile the library.  However, if the
   necessary build dependencies (jq, make, perl) are installed on the host, this
   can be disabled by defining the NO_DOCKER.  The dependency on jq may be
   avoided by passing a space-separated list of target ABIs via ABIS variable.