<?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.blogspot.developersu.ns_usbloader">

    <uses-feature android:name="android.hardware.usb.host" />

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> <!-- For Android 9 -->

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:resizeableActivity="true"
        android:supportsPictureInPicture="true"
        tools:ignore="GoogleAppIndexingWarning">  <!-- <- IDK WTF, RTFM MB -->
        <activity
            android:name=".SettingsActivity"
            android:label="@string/title_activity_settings"
            android:theme="@style/AppTheme.NoActionBar" />
        <activity
            android:name=".AboutActivity"
            android:label="@string/title_activity_about"
            android:theme="@style/AppTheme.NoActionBar" />
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <!-- TODO: ADD CUSTOM INTENTS WE USE -->
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
                <action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED" />
            </intent-filter>

            <meta-data
                android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
                android:resource="@xml/device_filter" />
            <meta-data
                android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"
                android:resource="@xml/device_filter" />
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:host="*"/>
                <data android:mimeType="*/*"/>
                <data android:pathPattern=".*\\.nsp"/>
                <data android:pathPattern=".*\\.nsz"/>
                <data android:pathPattern=".*\\.xci"/>
                <data android:pathPattern=".*\\.xcz"/>
                <data android:scheme="content"/>
            </intent-filter>
        </activity>

        <receiver
            android:name=".NsBroadcastReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="com.blogspot.developersu.ns_usbloader.SERVICE_TRANSFER_TASK_FINISHED" />
                <!--
                <action android:name="com.blogspot.developersu.ns_usbloader.ACTION_USB_PERMISSION" />
                <action android:name="com.blogspot.developersu.ns_usbloader.RISE_NOTIFICATION_OR_ACTIVITY" /> to handle if not handled by internally-registered receiver of MainActivity
                -->
            </intent-filter>
        </receiver>

        <service android:name=".service.CommunicationsService"
                 android:exported="false" />
    </application>

</manifest>
