office-gobmx/android/source/AndroidManifest.xml
Michael Weghorn e99991216e android: Fix taking photos by dropping permission
At least on recent devices (seen e.g. on an AVD
with API level 34 and a Fairphone 3 with LineageOS 20
(based on Android 13)), inserting a picture by
taking a photo using the camera didn't work,
"nothing was happening" when choosing the corresponding
option from the formatting toolbar with experimental
editing mode enabled.

This is due to the system filtering information about
other apps/packages with target API level >= 30 for
privacy reasons, see [1] for more details.

As described at [2], requesting the `CAMERA`
permission is not required:

> Users might take pictures in your app, using the pre-installed
> system camera app.
>
> In this situation, don't declare the CAMERA permission. Instead,
> invoke the ACTION_IMAGE_CAPTURE intent action.

In fact, specifying the permission is even counter-productive
and would cause this to not work, as also described at [2]:

> Note: If your app declares Manifest.permission.CAMERA
> permission and is not granted, then the action results in
> a SecurityException.

Rather than explicitly requesting the permission, just
drop it from the AndroidManifest, as it's not needed.
Also drop the additional code interacting with the package
manager, as that doesn't work with newer API
versions as described above.

With these changes in place, inserting a photo works fine
in tests in API 21 and API 34 AVDs and on the
above-mentioned Fairphone 3.

[1] https://developer.android.com/training/package-visibility
[2] https://developer.android.com/privacy-and-security/minimize-permission-requests#take-photo

Change-Id: Ia1ee4e4de577a269e2b79bf5460d08b1bf2bee56
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167603
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-05-14 08:37:49 +02:00

128 lines
6.4 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" />
<!-- App wants to know if device supports USB host capability(not mandatory) -->
<uses-feature android:name="android.hardware.usb.host" android:required="false"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<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="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" />
<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" />
<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.DayNight.DarkActionBar"
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:
-->