<?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.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <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" />
    <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />

    <application
        android:name=".PrismApplication"
        android:allowBackup="false"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@android:style/Theme.Material.NoActionBar"
        android:networkSecurityConfig="@xml/network_security_config">
        <provider
            android:name="androidx.startup.InitializationProvider"
            android:authorities="${applicationId}.androidx-startup"
            android:exported="false"
            tools:node="merge">
            <meta-data
                android:name="androidx.work.WorkManagerInitializer"
                android:value="androidx.startup"
                tools:node="remove" />
        </provider>

        <activity
            android:name=".activities.MainActivity"
            android:process=":ui"
            android:theme="@style/Theme.Prism.Launcher"
            android:windowSoftInputMode="adjustResize"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <service
            android:name=".services.FgService"
            android:enabled="true"
            android:exported="false"
            android:foregroundServiceType="specialUse">
            <property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
            android:value="This service needs to be constantly connected to the server via WebSocket to receive push notifications."/>
        </service>

        <service
            android:name=".services.PrismInternalService"
            android:enabled="true"
            android:exported="false">
            <intent-filter>
                <action android:name="org.unifiedpush.distributor.internal.service"/>
            </intent-filter>
        </service>

        <receiver
            android:name=".receivers.StartReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            </intent-filter>
        </receiver>
        <receiver
            android:name=".receivers.PrismConfigReceiver"
            android:enabled="true"
            android:exported="false">
            <intent-filter>
                <action android:name="app.lonecloud.prism.SET_PUSH_SERVICE_URL" />
                <action android:name="app.lonecloud.prism.SET_PRISM_SERVER_URL" />
                <action android:name="app.lonecloud.prism.SET_PRISM_API_KEY" />
            </intent-filter>
        </receiver>
        <receiver
            android:name=".receivers.RegisterBroadcastReceiver"
            android:enabled="true"
            android:exported="true"
            tools:ignore="ExportedReceiver">
            <intent-filter>
                <action android:name="org.unifiedpush.android.distributor.feature.BYTES_MESSAGE"/>
                <action android:name="org.unifiedpush.android.distributor.REGISTER" />
                <action android:name="org.unifiedpush.android.distributor.UNREGISTER" />
            </intent-filter>
        </receiver>
        <receiver
            android:name=".receivers.NotificationActionReceiver"
            android:enabled="true"
            android:exported="false" />
        <receiver
            android:name=".receivers.NotificationDismissReceiver"
            android:enabled="true"
            android:exported="false" />
    </application>

</manifest>