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

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="28"
        tools:ignore="ScopedStorage" />

    <uses-feature
        android:name="android.hardware.touchscreen"
        android:required="false" />
    <uses-feature
        android:name="android.software.leanback"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.camera"
        android:required="false" />

    <permission
        android:name="${applicationId}.permission.CONTROL_TUNNELS"
        android:description="@string/permission_description"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/permission_label"
        android:protectionLevel="dangerous" />

    <application
        android:name=".Application"
        android:allowBackup="false"
        android:banner="@mipmap/banner"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity
            android:name=".activity.TunnelToggleActivity"
            android:theme="@style/NoBackgroundTheme" />

        <activity android:name=".activity.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
            </intent-filter>
        </activity>

        <activity
            android:name=".activity.TvMainActivity"
            android:theme="@style/TvTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".activity.SettingsActivity"
            android:label="@string/settings"
            android:parentActivityName=".activity.MainActivity" />

        <activity
            android:name=".activity.TunnelCreatorActivity"
            android:label="@string/create_activity_title"
            android:parentActivityName=".activity.MainActivity" />

        <activity
            android:name="com.journeyapps.barcodescanner.CaptureActivity"
            android:screenOrientation="fullSensor"
            tools:replace="screenOrientation" />

        <activity
            android:name=".activity.LogViewerActivity"
            android:label="@string/log_viewer_title">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>

        <provider
            android:name=".activity.LogViewerActivity$ExportedLogContentProvider"
            android:authorities="${applicationId}.exported-log"
            android:exported="false"
            android:grantUriPermissions="true" />

        <receiver android:name=".BootShutdownReceiver">
            <intent-filter>
                <action android:name="android.intent.action.ACTION_SHUTDOWN" />
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

        <receiver
            android:name=".model.TunnelManager$IntentReceiver"
            android:permission="${applicationId}.permission.CONTROL_TUNNELS">
            <intent-filter>
                <action android:name="com.wireguard.android.action.REFRESH_TUNNEL_STATES" />
                <action android:name="com.wireguard.android.action.SET_TUNNEL_UP" />
                <action android:name="com.wireguard.android.action.SET_TUNNEL_DOWN" />
            </intent-filter>
        </receiver>

        <service
            android:name=".QuickTileService"
            android:icon="@drawable/ic_tile"
            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">

            <intent-filter>
                <action android:name="android.service.quicksettings.action.QS_TILE" />
            </intent-filter>

            <meta-data
                android:name="android.service.quicksettings.ACTIVE_TILE"
                android:value="false" />
        </service>

        <meta-data
            android:name="android.content.APP_RESTRICTIONS"
            android:resource="@xml/app_restrictions" />
    </application>

    <queries>
        <intent>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent>
    </queries>
</manifest>