<?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.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="32" tools:ignore="ScopedStorage" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
    <uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
    <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
    <!--<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>-->
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
    <uses-permission android:name="android.permission.WRITE_SETTINGS" tools:ignore="ProtectedPermissions"/>

    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
    <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.FutoVideo"
        android:usesCleartextTraffic="true"
        tools:replace="android:enableOnBackInvokedCallback"
        android:enableOnBackInvokedCallback="false"
        tools:targetApi="31"
        android:largeHeap="true">
        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="@string/authority"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
        </provider>

        <receiver android:name=".receivers.MediaButtonReceiver" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MEDIA_BUTTON" />
            </intent-filter>
        </receiver>

        <service android:name=".services.MediaPlaybackService"
            android:enabled="true"
            android:foregroundServiceType="mediaPlayback" />
        <service android:name=".services.DownloadService"
            android:enabled="true"
            android:foregroundServiceType="dataSync" />

        <receiver android:name=".receivers.MediaControlReceiver" />
        <receiver android:name=".receivers.AudioNoisyReceiver" />
        <receiver android:name=".receivers.PlannedNotificationReceiver" />

        <activity
            android:name=".activities.MainActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|uiMode"
            android:exported="true"
            android:theme="@style/Theme.FutoVideo.NoActionBar"
            android:windowSoftInputMode="adjustPan"
            android:launchMode="singleInstance"
            android:resizeableActivity="true"
            android:supportsPictureInPicture="true">

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

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

                <data android:scheme="grayjay" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

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

                <data android:scheme="fcast" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter android:autoVerify="true">
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.VIEW" />
                <data android:host="*" />
                <data android:scheme="file" />

                <data android:mimeType="application/json" />
            </intent-filter>
            <intent-filter android:autoVerify="true">
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.VIEW" />
                <data android:host="*" />
                <data android:scheme="content" />

                <data android:mimeType="application/json" />
            </intent-filter>
            <intent-filter android:autoVerify="true">
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.VIEW" />
                <data android:host="*" />
                <data android:scheme="file" />

                <data android:mimeType="text/plain" />
            </intent-filter>
            <intent-filter android:autoVerify="true">
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.VIEW" />
                <data android:host="*" />
                <data android:scheme="content" />

                <data android:mimeType="text/plain" />
            </intent-filter>
            <intent-filter android:autoVerify="true">
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.VIEW" />
                <data android:host="*" />
                <data android:scheme="file" />

                <data android:mimeType="application/zip" />
            </intent-filter>
            <intent-filter android:autoVerify="true">
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.VIEW" />
                <data android:host="*" />
                <data android:scheme="content" />

                <data android:mimeType="application/zip" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="polycentric" />
            </intent-filter>
        </activity>
        <activity
            android:name=".activities.TestActivity"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.SettingsActivity"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.DeveloperActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.ExceptionActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.CaptchaActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.LoginActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.AddSourceActivity"
            android:exported="true"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

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

                <data android:scheme="vfuto" />
            </intent-filter>
        </activity>
        <activity
            android:name=".activities.AddSourceOptionsActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.PolycentricHomeActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.PolycentricBackupActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.PolycentricCreateProfileActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.PolycentricProfileActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.PolycentricWhyActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.PolycentricImportProfileActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.ManageTabsActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.QRCaptureActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.FCastGuideActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.SyncHomeActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.SyncPairActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.SyncShowPairingCodeActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBarFitsSystem" />
        <activity
            android:name=".activities.PolycentricModerationActivity"
            android:exported="false"
            android:screenOrientation="portrait" />
        <activity
            android:name=".activities.QRCodeFullscreenActivity"
            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.FutoVideo.NoActionBar" />
        <service
            android:name=".UpdateDownloadService"
            android:exported="false"
            android:foregroundServiceType="dataSync" />

        <receiver
            android:name=".UpdateActionReceiver"
            android:exported="false" />

        <activity
            android:name=".activities.InstallUpdateActivity"
            android:exported="false"
            android:theme="@style/Theme.App.TransparentNoUi"
            android:excludeFromRecents="true"
            android:finishOnTaskLaunch="true" />

    </application>
</manifest>
