<?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.READ_EXTERNAL_STORAGE"
        android:maxSdkVersion="32" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"
        android:maxSdkVersion="30"
        tools:ignore="LeanbackUsesWifi" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_REMOTE_MESSAGING"/>
    <!--foreground service permissions-->
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <!--start service on boot permission-->
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <!--android tv support-->
    <uses-feature android:name="android.software.leanback"
        android:required="false" />
    <uses-feature android:name="android.hardware.touchscreen"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.location.gps"
        android:required="false" />
    <uses-feature
    android:name="android.hardware.screen.portrait"
    android:required="false" />
    <queries>
        <intent>
            <action android:name="android.intent.action.MAIN" />
        </intent>
    </queries>
    <application
        android:allowBackup="true"
        android:name=".WireGuardAutoTunnel"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:banner="@mipmap/ic_banner"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.WireguardAutoTunnel"
        tools:targetApi="31">
        <activity
            android:name=".ui.MainActivity"
            android:exported="true"
            android:theme="@style/Theme.WireguardAutoTunnel">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
            </intent-filter>
        </activity>
        <service
            android:name=".service.foreground.ForegroundService"
            android:enabled="true"
            android:foregroundServiceType="remoteMessaging"
            android:exported="false">
        </service>
        <service
            android:name=".service.foreground.WireGuardTunnelService"
            android:permission="android.permission.BIND_VPN_SERVICE"
            android:enabled="true"
            android:foregroundServiceType="remoteMessaging"
            android:exported="false">
            <intent-filter>
                <action android:name="android.net.VpnService"/>
            </intent-filter>
            <meta-data android:name="android.net.VpnService.SUPPORTS_ALWAYS_ON"
                android:value="true"/>
        </service>
        <service
            android:name=".service.foreground.WireGuardConnectivityWatcherService"
            android:enabled="true"
            android:stopWithTask="false"
            android:foregroundServiceType="location"
            android:permission=""
            android:exported="false">
        </service>
        <receiver android:enabled="true" android:name=".receiver.BootReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
            </intent-filter>
        </receiver>
        <receiver android:exported="false" android:name=".receiver.NotificationActionReceiver"/>
        <meta-data
            android:name="com.google.mlkit.vision.DEPENDENCIES"
            android:value="barcode_ui"/>
        <meta-data
            android:name="firebase_crashlytics_collection_enabled"
            android:value="true" />
    </application>
</manifest>