<?xml version="1.0" encoding="utf-8"?>

<!--
SPDX-FileCopyrightText: 2023 suyu Emulator Project
SPDX-License-Identifier: GPL-3.0-or-later
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
    <uses-feature android:name="android.hardware.gamepad" android:required="false" />
    <uses-feature android:name="android.software.leanback" android:required="false" />
    <uses-feature android:name="android.hardware.vulkan.version" android:version="0x401000" android:required="true" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.NFC" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <application
        android:name="org.suyu.suyu_emu.SuyuApplication"
        android:label="@string/app_name_suffixed"
        android:icon="@drawable/ic_launcher"
        android:allowBackup="true"
        android:hasFragileUserData="false"
        android:supportsRtl="true"
        android:isGame="true"
        android:appCategory="game"
        android:banner="@drawable/tv_banner"
        android:fullBackupContent="@xml/data_extraction_rules"
        android:dataExtractionRules="@xml/data_extraction_rules_api_31"
        android:enableOnBackInvokedCallback="true">

        <meta-data android:name="android.game_mode_config"
            android:resource="@xml/game_mode_config" />

        <activity
            android:name="org.suyu.suyu_emu.ui.main.MainActivity"
            android:exported="true"
            android:theme="@style/Theme.Suyu.Splash.Main">

            <!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
            <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>

        <activity
            android:name="org.suyu.suyu_emu.features.settings.ui.SettingsActivity"
            android:theme="@style/Theme.Suyu.Main"
            android:label="@string/preferences_settings"/>

        <activity
            android:name="org.suyu.suyu_emu.activities.EmulationActivity"
            android:theme="@style/Theme.Suyu.Main"
            android:launchMode="singleTop"
            android:supportsPictureInPicture="true"
            android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|uiMode"
            android:exported="true">

            <intent-filter>
                <action android:name="android.nfc.action.TECH_DISCOVERED" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="application/octet-stream" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data
                    android:mimeType="application/octet-stream"
                    android:scheme="content"/>
            </intent-filter>

            <meta-data
                android:name="android.nfc.action.TECH_DISCOVERED"
                android:resource="@xml/nfc_tech_filter" />
        </activity>

        <provider
            android:name=".features.DocumentProvider"
            android:authorities="${applicationId}.user"
            android:grantUriPermissions="true"
            android:exported="true"
            android:permission="android.permission.MANAGE_DOCUMENTS">
            <intent-filter>
                <action android:name="android.content.action.DOCUMENTS_PROVIDER" />
            </intent-filter>
        </provider>

    </application>

</manifest>
