Files
loongoffice/android/source/AndroidManifest.xml
Michael Weghorn 45fbfbfeae tdf#131622 android: Extract native libs again
Commit 66518ead516e90d606e87c6ce58ec11fea6d172e
("use extractNativeLibs="false" for less disk usage and
faster installation", 2017-08-31) had set
'extractNativeLibs="false"' in Android's manifest
for the debug build case, which prevented the shared native
libraries from being extracted on the device.

However, while e.g. liblo-native-code.so can be handled just
fine when it is in the APK in uncompressed form, the
NSS library tries to load modules at runtime by using an
explicit path to the module
(like '/data/user/0/org.libreoffice/lib/libnssckbi.so';
due to 'LO_LIB_DIR=file://$APP_DATA_DIR/lib/' set in
fundamentalrc (as defined in build.gradle)), but the
library was no longer there, so NSS
initalization failed (s. 'nsscrypto_initialize').

As a result, Android Viewer was unable to open
encrypted/password-protected files.

Therefore, extract the libs again for the debug case
as well to make that work again. (Release mode
still had 'extractNativeLibs="true"' anyway.)

Side note 1: According to [1], it should in general
also be possible to use 'dlopen()' for dynamic libraries
inside zip files (like the APK):

> Note that in API level 23 and above dlopen(3) will
> open a library from any zip file, not just your APK.
> Just give dlopen(3) a path of the form
> "my_zip_file.zip!/libs/libstuff.so". As with APKs,
> the library must be page-aligned and stored uncompressed
> for this to work.

In any case, if that approach were to be taken, that
would need some closer look to make it work, e.g. how to
retrieve the actual location of the APK file, how to treat
the different architecturs, whether that works for all
supported Android versions,...

Side note 2: To debug into the NSS library,
temporarily avoiding stripping the debug information
as follows helped:

        --- a/android/Bootstrap/Makefile.shared
        +++ b/android/Bootstrap/Makefile.shared
        @@ -68,7 +68,7 @@ $(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so

         $(SODEST)/nss-libraries :
                mkdir -p $(SODEST)
        -       $(foreach lib,$(NSSLIBS),$(STRIP) -o $(SODEST)/lib$(lib).so $(INSTDIR)/$(LIBO_LIB_FOLDER)/lib$(lib).so;)
        +       $(foreach lib,$(NSSLIBS),cp $(INSTDIR)/$(LIBO_LIB_FOLDER)/lib$(lib).so $(SODEST)/lib$(lib).so;)

         $(SODEST)/libc++_shared.so : $(ANDROID_NDK_HOME)/sources/cxx-stl/llvm-libc++/libs/$(ANDROID_APP_ABI)/libc++_shared.so
                cp $< $@

[1] https://github.com/aosp-mirror/platform_bionic/blob/master/android-changes-for-ndk-developers.md#opening-shared-libraries-directly-from-an-apk

Change-Id: I7631e4a1e5e3d7b3b589ba09d62b52dc5c55836c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91229
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2020-03-27 19:54:32 +01:00

153 lines
7.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="${installLocation}"
package="org.libreoffice">
<!-- App requires OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<!-- App wants to know if device supports USB host capability(not mandatory) -->
<uses-feature android:name="android.hardware.usb.host" android:required="false"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET" />
<!-- extractNativeLibs="true" needed e.g. for NSS to load modules at runtime -->
<application
android:name=".LibreOfficeApplication"
android:allowBackup="true"
android:extractNativeLibs="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/LibreOfficeTheme"
android:hardwareAccelerated="true"
android:largeHeap="false">
<!-- Viewer Activity -->
<!-- When changing android:windowSoftInputMode, please don't specify multiple "adjust..." or "state...". -->
<activity
android:name=".LibreOfficeMainActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize"
android:windowSoftInputMode="adjustResize" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file"/>
<data android:scheme="content"/>
<!-- Please keep this in sync with FileUtilities.java. -->
<!-- ODF -->
<data android:mimeType="application/vnd.oasis.opendocument.text" />
<data android:mimeType="application/vnd.oasis.opendocument.graphics" />
<data android:mimeType="application/vnd.oasis.opendocument.presentation" />
<data android:mimeType="application/vnd.oasis.opendocument.spreadsheet"/>
<data android:mimeType="application/vnd.oasis.opendocument.text-flat-xml" />
<data android:mimeType="application/vnd.oasis.opendocument.graphics-flat-xml" />
<data android:mimeType="application/vnd.oasis.opendocument.presentation-flat-xml" />
<!-- TODO: opening FODS documents crashes currently
<data android:mimeType="application/vnd.oasis.opendocument.spreadsheet-flat-xml" />
-->
<!-- ODF templates -->
<data android:mimeType="application/vnd.oasis.opendocument.text-template"/>
<data android:mimeType="application/vnd.oasis.opendocument.spreadsheet-template"/>
<data android:mimeType="application/vnd.oasis.opendocument.graphics-template"/>
<!-- Seems at least Android 5.0 does not recognize this as the mime type of .otp files. -->
<data android:mimeType="application/vnd.oasis.opendocument.presentation-template"/>
<!-- MS -->
<data android:mimeType="application/rtf" />
<data android:mimeType="text/rtf" />
<data android:mimeType="application/msword" />
<data android:mimeType="application/vnd.ms-powerpoint" />
<data android:mimeType="application/vnd.ms-excel"/>
<data android:mimeType="application/vnd.visio" />
<data android:mimeType="application/vnd.visio.xml" />
<data android:mimeType="application/x-mspublisher" />
<!-- OOXML -->
<data android:mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
<data android:mimeType="application/vnd.openxmlformats-officedocument.presentationml.presentation" />
<!-- Currently crashes. <data android:mimeType="application/vnd.openxmlformats-officedocument.presentationml.slideshow"/> -->
<data android:mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document" />
<!-- OOXML templates -->
<data android:mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.template"/>
<data android:mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.template"/>
<data android:mimeType="application/vnd.openxmlformats-officedocument.presentationml.template"/>
<!-- OTHER -->
<data android:mimeType="text/csv"/>
<data android:mimeType="text/comma-separated-values"/>
<data android:mimeType="application/vnd.ms-works" />
<data android:mimeType="application/vnd.apple.keynote" />
<data android:mimeType="application/x-abiword" />
<data android:mimeType="application/x-pagemaker" />
<data android:mimeType="image/x-emf" />
<data android:mimeType="image/x-svm" />
<data android:mimeType="image/x-wmf" />
<data android:mimeType="image/svg+xml" />
</intent-filter>
</activity>
<activity
android:name=".SettingsActivity"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
android:label="@string/app_name_settings">
</activity>
<!-- Document Browser Activity -->
<activity android:name="org.libreoffice.ui.LibreOfficeUIActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Document Provider Settings Activity -->
<activity android:name=".storage.DocumentProviderSettingsActivity"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
android:label="@string/storage_provider_settings">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name=".storage.external.BrowserSelectorActivity" >
</activity>
<activity android:name=".storage.external.DirectoryBrowserActivity"
android:label="@string/directory_browser_label"
android:windowSoftInputMode="stateHidden">
</activity>
<activity android:name=".PresentationActivity"
android:screenOrientation="landscape" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".LibreOfficeMainActivity" />
</activity>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>
<!-- vim: shiftwidth=4 softtabstop=4 expandtab:
-->