In the past, LibreOffice Viewer for Android was directly
accessing storage in order to open/save files and when
exporting to PDF.
However, that was switched to using Android's Storage
Access Framework [1], available since Android 4.4
(API level 19), i.e. it is available in all Android
versions supported by the app.
In the past, in order to directly access storage, permission
android.permission.WRITE_EXTERNAL_STORAGE was needed.
That permission no longer has any effect in
Android 11 (API level 30) or higher, quoting from [2]:
> More recent versions of Android rely more on a file's purpose than its
> location for determining an app's ability to access, and write to, a
> given file. In particular, if your app targets Android 11 (API level 30)
> or higher, the WRITE_EXTERNAL_STORAGE permission doesn't have any
> effect on your app's access to storage. This purpose-based storage
> model improves user privacy because apps are given access only to
> the areas of the device's file system that they actually use.
>
> Android 11 introduces the MANAGE_EXTERNAL_STORAGE permission, which
> provides write access to files outside the app-specific directory and
> MediaStore. To learn more about this permission, and why most apps don't
> need to declare it to fulfill their use cases, see the guide on how to
> manage all files [3] on a storage device.
Since PDF export was also switched to use the
Android Storage Framework mechanism in
commit 9ebcb80e2e
Author: Michael Weghorn
Date: Thu Apr 15 11:22:46 2021 +0200
android: Ask where to save PDF file on export
, eventually drop the permission now.
As mentioned in
commit 7d9db806d6
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Fri Apr 9 11:24:16 2021 +0200
android: Request PERMISSION_WRITE_EXTERNAL_STORAGE again
which re-requested the permission before PDF export was
ported to use the Android Storage Framework, the case of
applications passing documents via a file:// URI would also
require storage permission in order to access the file.
However, apps that properly pass the file should pass a
content:// URL instead.
Quoting from the Android 7.0 Behavior changes
documentation [4]:
> Passing file:// URIs outside the package domain may leave the receiver
> with an unaccessible path. Therefore, attempts to pass a file:// URI
> trigger a FileUriExposedException. The recommended way to share the
> content of a private file is using the FileProvider.
(Using content:// URIs has been possible long before Android 7.0,
however.)
Therefore, drop support for file:// URIs as well, which
will prevent apps that would otherwise try to pass file://
URIs from trying to do that for Android Viewer.
If this results in any app no longer being able to
open documents in LibreOffice Viewer, that app most
likely needs to be adjusted to pass a content:// URI instead,
which will also make it work for newer Android versions.
(Total Commander is one case that apparently doesn't do
that yet, previously resulting in a crash when storage
permissions were not granted, see tdf#164082. That is
reproducible in an Android 7.0 AVD, while opening
the file fromm other apps, e.g. from Material Files [5],
works perfectly fine, using content:// URIs.)
Eventually dropping the permission makes clear that
the app does not need direct storage access, which is
also relevant for security reviews, and addresses this
lint issue from android/source/lint-baseline.xml:
<issue
id="ScopedStorage"
message="WRITE_EXTERNAL_STORAGE is deprecated (and is not granted) when targeting Android 13+. If you need to write to shared storage, use the `MediaStore.createWriteRequest` intent."
errorLine1=" <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="AndroidManifest.xml"
line="9"
column="36"/>
</issue>
That file will be updated/regenerated in a separate
commit.
[1] https://developer.android.com/training/data-storage/shared/documents-files
[2] https://developer.android.com/training/data-storage#permissions
[3] https://developer.android.com/training/data-storage/manage-all-files
[4] https://developer.android.com/about/versions/nougat/android-7.0-changes
[5] https://f-droid.org/en/packages/me.zhanghai.android.files/
Change-Id: Iafb7a32668718afc638b8273a05a9d0618f85550
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194215
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
125 lines
6.1 KiB
XML
125 lines
6.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
android:installLocation="${installLocation}">
|
|
|
|
<!-- App requires OpenGL ES 2.0 -->
|
|
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
|
|
|
<application
|
|
android:name=".LibreOfficeApplication"
|
|
android:allowBackup="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:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize"
|
|
android:windowSoftInputMode="adjustResize"
|
|
android:exported="true">
|
|
|
|
<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="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" />
|
|
<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.visio2013" />
|
|
<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" />
|
|
<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:label="@string/app_name_settings">
|
|
</activity>
|
|
|
|
<!-- Document Browser Activity -->
|
|
<activity android:name="org.libreoffice.ui.LibreOfficeUIActivity"
|
|
android:exported="true">
|
|
<intent-filter>
|
|
<action android:name="android.intent.action.MAIN" />
|
|
<category android:name="android.intent.category.LAUNCHER" />
|
|
</intent-filter>
|
|
</activity>
|
|
|
|
<activity android:name=".PresentationActivity"
|
|
android:screenOrientation="landscape" >
|
|
<meta-data
|
|
android:name="android.support.PARENT_ACTIVITY"
|
|
android:value=".LibreOfficeMainActivity" />
|
|
</activity>
|
|
|
|
<provider
|
|
android:name="androidx.core.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:
|
|
-->
|