<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Talk to the WebTerm server over WS/HTTP. No NEARBY_WIFI_DEVICES: Android
         has no local-network permission prompt; plain WS to a LAN IP needs none
         (plan §8 / R12). -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- Push (A30/A31) — requested with rationale at runtime on API 33+. -->
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <!-- QR pairing (A19) — CameraX preview; requested with rationale at runtime, denial
         degrades to manual URL entry. android:required=false so non-camera devices install. -->
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera.any" android:required="false" />

    <application
        android:name=".WebTermApp"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/Theme.WebTerm"
        android:networkSecurityConfig="@xml/network_security_config"
        android:usesCleartextTraffic="false">

        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:theme="@style/Theme.WebTerm">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <!-- A32 deep links → DeepLinkRouter (v4-UUID whitelist; the manifest never validates). -->
            <!-- Custom scheme: webterminal://open?host=<uuid>&join=<uuid> -->
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="webterminal" android:host="open" />
            </intent-filter>
            <!-- Verified App Link: https://terminal.yaojia.wang/open?host=&join= .
                 autoVerify needs assetlinks.json (release SHA-256) served at
                 /.well-known/assetlinks.json — a deploy artifact (§8), not built here. -->
            <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" android:host="terminal.yaojia.wang" android:pathPrefix="/open" />
            </intent-filter>
        </activity>

        <!-- Push (A30) — FCM data-only entry point (server sends no notification block). -->
        <service
            android:name=".push.FcmService"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
        <!-- Deny action: auth-free, no-UI, expedited POST (goAsync). -->
        <receiver
            android:name=".push.DenyBroadcastReceiver"
            android:exported="false" />
        <!-- Allow action: translucent, excluded-from-recents trampoline hosting BiometricPrompt
             (a receiver/service cannot present it — R1). -->
        <activity
            android:name=".push.AllowTrampolineActivity"
            android:theme="@style/Theme.WebTerm.Translucent"
            android:excludeFromRecents="true"
            android:taskAffinity=""
            android:exported="false" />

    </application>

</manifest>
