<?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" />
    <!-- The phone as an OxygenFlow runner (#8): a foreground service while it runs jobs,
         its notification, and the network's state for the Wi-Fi rule. -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <!-- The check for proposals ready to land (#20) is kept across reboots, and the runner (#8) offered again. -->
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    <application
        android:name=".OxygenHubApp"
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.OxygenHub">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:theme="@style/Theme.OxygenHub"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <service
            android:name=".runner.RunnerService"
            android:exported="false"
            android:foregroundServiceType="specialUse">
            <property
                android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
                android:value="Runs OxygenFlow CI jobs (WebAssembly) for the signed-in account while the phone is charging on Wi-Fi" />
        </service>
        <receiver
            android:name=".runner.RunnerResume"
            android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            </intent-filter>
        </receiver>
        <!-- The home screen widget (#28): latest runs, unread, reviews waiting. -->
        <receiver
            android:name=".widget.HubWidgetReceiver"
            android:exported="true"
            android:label="@string/widget_name">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>
            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/hub_widget_info" />
        </receiver>
        <!-- Alerts from the hub (#16): sealed data messages through Cloud Messaging. -->
        <service
            android:name=".alerts.AlertService"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
        <service
            android:name=".alerts.LandCheckJob"
            android:exported="false"
            android:permission="android.permission.BIND_JOB_SERVICE" />
    </application>

</manifest>