6.4 KiB · text History cf032d1
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <!-- The upload progress notification, and the uploads running as a
         foreground service so a long batch isn't cut short. -->
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
    <!-- Photos' locations: Android takes the GPS out of shared photos unless
         the app may see it, and reads the originals behind Google Photos'
         share links (upload/Originals.kt). Asked for from the app's screen,
         never needed to upload. -->
    <uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
    <uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>

    <application
        android:name=".CartosnapApplication"
        android:label="@string/app_name"
        android:icon="@mipmap/ic_icon"
        android:roundIcon="@mipmap/ic_icon"
        android:allowBackup="false"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:supportsRtl="true"
        android:theme="@style/Theme.Cartosnap"
        android:usesCleartextTraffic="${cleartext}">

        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTask"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>

            <!--
                cartosnap://auth?code=… — the end of a "Sign in with NEIAM" in
                the browser (Custom Tab): the server's one-time code, useless
                without the PKCE verifier that never leaves the app. A custom
                scheme because the server is whichever the user picked, and
                an App Link would have to name its host here.
            -->
            <intent-filter android:autoVerify="false">
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="cartosnap" android:host="auth"/>
            </intent-filter>

            <!--
                Magic links, as verified App Links (autoVerify), on the
                production host only (appLinksHost in app/build.gradle.kts):
                Android opens them in this app only when
                https://<host>/.well-known/assetlinks.json lists this
                package and its signing certificate (ANDROID_CERT_FINGERPRINTS
                on the server). Otherwise they open in the browser, where
                they work as before. Never a custom scheme: the token is a
                credential by itself.

                  /users/log-in/<token>   the web's magic link (phx.gen.auth)
            -->
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="https"/>
                <data android:host="${appLinksHost}"/>
                <data android:pathPrefix="/users/log-in/"/>
            </intent-filter>
        </activity>

        <!-- Photos shared from the gallery or camera. One screen, two ways
             into it, each its own entry in the share sheet: -->
        <activity
            android:name=".ShareActivity"
            android:exported="false"
            android:excludeFromRecents="true"
            android:taskAffinity=""
            android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboardHidden|uiMode|density"
            android:theme="@style/Theme.Cartosnap.Share"/>

        <!-- "Add to a trip…": pick the trip from a list. -->
        <activity-alias
            android:name=".ShareToTrip"
            android:targetActivity=".ShareActivity"
            android:label="@string/share_to_trip"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.SEND"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:mimeType="image/*"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND_MULTIPLE"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:mimeType="image/*"/>
            </intent-filter>
        </activity-alias>

        <!-- "Add to last trip": straight into the trip used last, no questions. -->
        <activity-alias
            android:name=".ShareToLastTrip"
            android:targetActivity=".ShareActivity"
            android:label="@string/share_to_last_trip"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.SEND"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:mimeType="image/*"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND_MULTIPLE"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:mimeType="image/*"/>
            </intent-filter>
        </activity-alias>

        <!-- WorkManager's foreground service, declared as data sync so
             Android 14 lets uploads run in it. -->
        <service
            android:name="androidx.work.impl.foreground.SystemForegroundService"
            android:foregroundServiceType="dataSync"
            tools:node="merge"/>
    </application>
</manifest>