<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="deckers.thibault.aves"
    android:installLocation="auto">

    <!--
    Scoped storage for primary storage is unusable on Android Q,
    because users are required to confirm each file to be edited or deleted.
    These items can only be deleted one by one after catching
    a `RecoverableSecurityException` and requesting permission for each.

    Android R improvements:
    - bulk changes (e.g. `createDeleteRequest`):
    https://developer.android.com/preview/privacy/storage#media-file-access
    - raw path access:
    https://developer.android.com/preview/privacy/storage#media-files-raw-paths

    Android R issues:
    - users cannot grant directory access to the root Downloads directory,
    - users cannot grant directory access to the root directory of each reliable SD card volume
    -->

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <!-- request write permission until Q (29) included, because scoped storage is unusable -->
    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="29" />
    <uses-permission android:name="android.permission.INTERNET" />

    <!-- to access media with unredacted metadata with scoped storage (Android Q+) -->
    <uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />

    <!-- TODO TLAD remove this permission once this issue is fixed:
    https://github.com/flutter/flutter/issues/42349
    https://github.com/flutter/flutter/issues/42451
    -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <!-- from Android R, we should define <queries> to make other apps visible to this app -->
    <queries>
        <intent>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent>
    </queries>

    <application
        android:name="io.flutter.app.FlutterApplication"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:requestLegacyExternalStorage="true">
        <activity
            android:name=".MainActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:launchMode="singleTop"
            android:theme="@style/AppTheme"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter tools:ignore="AppLinkUrlError">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="image/*" />
                <data android:mimeType="video/*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.GET_CONTENT" />
                <category android:name="android.intent.category.OPENABLE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="image/*" />
                <data android:mimeType="video/*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.PICK" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="image/*" />
                <data android:mimeType="video/*" />
            </intent-filter>
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="false" />
        </activity>
        <!-- file provider to share files having a file:// URI -->
        <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/provider_paths" />
        </provider>
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="${googleApiKey}" />
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>
