<?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="eu.faircode.netguard"
    android:installLocation="internalOnly">

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.android.vending.BILLING" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <!-- http://developer.android.com/guide/topics/security/permissions.html#normal-dangerous -->
    <!-- https://developer.android.com/preview/privacy/package-visibility -->
    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
    <!--
queries>
        <intent>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent>
    </queries
    -->
    <permission
        android:name="eu.faircode.netguard.permission.ADMIN"
        android:description="@string/app_description"
        android:label="@string/app_name"
        android:protectionLevel="signature" />

    <uses-permission android:name="eu.faircode.netguard.permission.ADMIN" />

    <uses-feature
        android:name="android.hardware.wifi"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.telephony"
        android:required="false" />
    <uses-feature
        android:name="android.software.app_widgets"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.touchscreen"
        android:required="false" />

    <application
        android:name=".ApplicationEx"
        android:allowBackup="false"
        android:appCategory="productivity"
        android:description="@string/app_description"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:networkSecurityConfig="@xml/network_security_config"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppThemeTeal"
        tools:ignore="ManifestResource">
        <activity
            android:name=".GenieActivity"
            android:exported="false" />

        <meta-data
            android:name="android.max_aspect"
            android:value="2.1" />

        <activity
            android:name=".ActivityMain"
            android:configChanges="orientation|screenSize"
            android:exported="true"
            android:label="@string/app_name"
            android:launchMode="singleTop"
            android:resizeableActivity="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <!--
            intent-filter android:label="@string/app_name">
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:host="www.netguard.me"
                    android:pathPrefix="/"
                    android:scheme="https" />
            </intent-filter
            -->

            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/shortcuts" />
        </activity>
        <activity
            android:name=".ActivitySettings"
            android:configChanges="orientation|screenSize"
            android:exported="true"
            android:label="@string/menu_settings"
            android:parentActivityName=".ActivityMain">
            <intent-filter>
                <action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.APPLICATION_PREFERENCES" />

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

            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".ActivityMain" />
        </activity>
        <activity
            android:name=".ActivityLog"
            android:configChanges="orientation|screenSize"
            android:label="@string/menu_log"
            android:parentActivityName=".ActivityMain">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".ActivityMain" />
        </activity>
        <activity
            android:name=".ActivityPro"
            android:configChanges="orientation|screenSize"
            android:label="@string/title_pro"
            android:parentActivityName=".ActivityMain">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".ActivityMain" />
        </activity>
        <activity
            android:name=".ActivityDns"
            android:configChanges="orientation|screenSize"
            android:label="@string/setting_show_resolved"
            android:parentActivityName=".ActivitySettings">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".ActivitySettings" />
        </activity>
        <activity
            android:name=".ActivityForwarding"
            android:configChanges="orientation|screenSize"
            android:label="@string/setting_forwarding"
            android:parentActivityName=".ActivitySettings">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".ActivitySettings" />
        </activity>
        <activity
            android:name=".ActivityForwardApproval"
            android:configChanges="orientation|screenSize"
            android:exported="true"
            android:label="@string/app_name"
            android:theme="@style/AppDialog">
            <intent-filter>
                <action android:name="eu.faircode.netguard.START_PORT_FORWARD" />
                <action android:name="eu.faircode.netguard.STOP_PORT_FORWARD" />
            </intent-filter>
        </activity>

        <service
            android:name=".ServiceSinkhole"
            android:exported="true"
            android:label="@string/app_name"
            android:permission="android.permission.BIND_VPN_SERVICE">
            <intent-filter>
                <action android:name="android.net.VpnService" />
            </intent-filter>
        </service>
        <service
            android:name=".ServiceExternal"
            android:exported="true"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="eu.faircode.netguard.DOWNLOAD_HOSTS_FILE" />
            </intent-filter>
        </service>
        <service
            android:name=".ServiceTileMain"
            android:exported="true"
            android:icon="@drawable/ic_security_white_24dp"
            android:label="@string/app_name"
            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
            <intent-filter>
                <action android:name="android.service.quicksettings.action.QS_TILE" />
            </intent-filter>
        </service>
        <service
            android:name=".ServiceTileGraph"
            android:exported="true"
            android:icon="@drawable/ic_equalizer_white_24dp"
            android:label="@string/setting_stats_category"
            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
            <intent-filter>
                <action android:name="android.service.quicksettings.action.QS_TILE" />
            </intent-filter>
        </service>
        <service
            android:name=".ServiceTileFilter"
            android:exported="true"
            android:icon="@drawable/ic_filter_list_white_24dp"
            android:label="@string/setting_filter"
            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
            <intent-filter>
                <action android:name="android.service.quicksettings.action.QS_TILE" />
            </intent-filter>
        </service>
        <service
            android:name=".ServiceTileLockdown"
            android:exported="true"
            android:icon="@drawable/ic_lock_outline_white_24dp"
            android:label="@string/setting_lockdown"
            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
            <intent-filter>
                <action android:name="android.service.quicksettings.action.QS_TILE" />
            </intent-filter>
        </service>

        <receiver
            android:name=".ReceiverAutostart"
            android:exported="true"
            android:label="@string/app_name">
            <intent-filter android:priority="999">
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            </intent-filter>
        </receiver>
        <receiver
            android:name=".ReceiverPackageRemoved"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_FULLY_REMOVED" />

                <data android:scheme="package" />
            </intent-filter>
        </receiver>
        <receiver
            android:name=".WidgetMain"
            android:exported="true"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/widgetmain" />
        </receiver>
        <receiver
            android:name=".WidgetLockdown"
            android:exported="true"
            android:label="@string/setting_lockdown">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/widgetlockdown" />
        </receiver>
        <receiver
            android:name=".WidgetAdmin"
            android:exported="true"
            android:label="@string/app_name"
            android:permission="eu.faircode.netguard.permission.ADMIN">
            <intent-filter>
                <action android:name="eu.faircode.netguard.ON" />
                <action android:name="eu.faircode.netguard.OFF" />
                <action android:name="eu.faircode.netguard.LOCKDOWN_ON" />
                <action android:name="eu.faircode.netguard.LOCKDOWN_OFF" />
            </intent-filter>
        </receiver>
    </application>

</manifest>