Context: dotnet#1906
Fixes: dotnet#1906
Android API 23 introduced a new way of dealing with the native shared libraries
shipped in the APK. Before that API level, the libraries would be always
extraced and placed in the application data directory, thus occupying more space
than necessary. API 23 added a new manifest `<application>` element attribute,
`android:extractNativeLibs`, which if set makes Android not extract the
libraries to the filesystem. API 23 added a way to load those libraries directly
from the APK. In order to support that there are a few requirements which this
commit implements:
* DSO (`.so`) files must be stored uncompressed in the APK
* `<application android:extractNativeLibs="false"/>` must be present
* DSOs in the APK must be aligned on the memory page boundary (the `-p` flag
passed to `zipalign` takes care of that
This commit also implements `libmonodroid` suport for loading our DSOs directly
from the APK. This operation mode is enabled by the presence of the
`__XA_DSO_IN_APK` environment variable. This variable is inserted into the
application's environment by way of placing it in the environment file (a file
part of the XA project that is marked with the `AndroidEnvironment` build
action). In that mode, the DSOs are *no longer* looked up in the application
data directory but only in the override directories (if the APK is built in
Debug configuration) and in the APK itself.
Currently, in order to activate the above mode, one has to perform the following
actions manually:
* Add the `android:extractNativeLibs="false"` attribute to the `<application>`
element in the `Properties/AndroidManifest.xml` file
* Add the following property to the project file:
<AndroidStoreUncompressedFileExtensions>.so</AndroidStoreUncompressedFileExtensions>
* Add an android environment file to the project with a line which says
__XA_DSO_IN_APK=1
After that the application should work in the embedded DSO mode without
problems.
A couple of tests are provided to test building and execution of embedded DSO
application on device, as well as to validate the built APK.