<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.streamvault.app.debug"
    android:versionCode="16"
    android:versionName="1.0.15-debug" >

    <uses-sdk
        android:minSdkVersion="25"
        android:targetSdkVersion="36" />

    <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.REQUEST_INSTALL_PACKAGES" />
    <uses-permission android:name="com.android.providers.tv.permission.READ_EPG_DATA" />
    <uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" />
    <uses-permission android:name="android.permission.BIND_TV_INPUT" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
    <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

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

    <queries>
        <intent>
            <action android:name="com.streamvault.plugin.API" />
        </intent>
        <intent>
            <action android:name="android.intent.action.VIEW" />

            <data android:mimeType="video/*" />
        </intent>
        <intent>
            <action android:name="android.intent.action.VIEW" />

            <data android:mimeType="application/x-mpegURL" />
        </intent>
        <intent>
            <action android:name="android.intent.action.VIEW" />

            <data android:mimeType="application/vnd.apple.mpegurl" />
        </intent>

        <package android:name="com.google.android.gms.policy_cast_dynamite" />
    </queries>

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

    <permission
        android:name="com.streamvault.app.debug.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.streamvault.app.debug.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" /> <!-- To store the heap dumps and leak analysis results. -->
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:name="com.streamvault.app.StreamVaultApp"
        android:allowBackup="false"
        android:appComponentFactory="androidx.core.app.CoreComponentFactory"
        android:banner="@drawable/app_banner"
        android:debuggable="true"
        android:extractNativeLibs="false"
        android:icon="@mipmap/ic_launcher_vault"
        android:label="@string/app_name"
        android:networkSecurityConfig="@xml/network_security_config"
        android:roundIcon="@mipmap/ic_launcher_vault"
        android:supportsRtl="true"
        android:theme="@style/Theme.StreamVault"
        android:usesCleartextTraffic="false" >
        <activity
            android:name="com.streamvault.app.MainActivity"
            android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize|screenLayout|smallestScreenSize"
            android:exported="true"
            android:launchMode="singleTask"
            android:screenOrientation="landscape"
            android:supportsPictureInPicture="true"
            android:windowSoftInputMode="adjustResize" >
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />

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

                <category android:name="android.intent.category.DEFAULT" />
            </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:mimeType="audio/x-mpegurl" />
                <data android:mimeType="audio/mpegurl" />
                <data android:mimeType="application/x-mpegurl" />
                <data android:mimeType="application/vnd.apple.mpegurl" />
                <data android:mimeType="application/mpegurl" />
                <data
                    android:pathPattern=".*\\.m3u"
                    android:scheme="content" />
                <data
                    android:pathPattern=".*\\.m3u8"
                    android:scheme="content" />
                <data
                    android:pathPattern=".*\\.m3u"
                    android:scheme="file" />
                <data
                    android:pathPattern=".*\\.m3u8"
                    android:scheme="file" />
            </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:mimeType="application/json" />
                <data android:mimeType="text/json" />
                <data android:mimeType="application/x-json" />
                <data
                    android:pathPattern=".*\\.json"
                    android:scheme="content" />
                <data
                    android:pathPattern=".*\\.json"
                    android:scheme="file" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND" />

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

                <data android:mimeType="application/json" />
                <data android:mimeType="text/json" />
                <data android:mimeType="application/x-json" />
                <data android:mimeType="application/octet-stream" />
            </intent-filter>

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

            <!-- TV Launcher entry point -->
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.streamvault.app.cast.CastRouteChooserActivity"
            android:excludeFromRecents="true"
            android:exported="false"
            android:launchMode="singleTop"
            android:theme="@style/Theme.StreamVault.CastChooser" />
        <activity
            android:name="com.streamvault.app.tvinput.TvInputSetupActivity"
            android:excludeFromRecents="true"
            android:exported="true"
            android:launchMode="singleTask"
            android:theme="@style/Theme.StreamVault" />
        <activity
            android:name="com.streamvault.app.diagnostics.ExternalPlayerProbeActivity"
            android:excludeFromRecents="true"
            android:exported="false"
            android:theme="@style/Theme.StreamVault" />

        <service
            android:name="com.streamvault.app.tvinput.StreamVaultTvInputService"
            android:exported="true"
            android:label="StreamVault Live Channels"
            android:permission="android.permission.BIND_TV_INPUT" >
            <intent-filter>
                <action android:name="android.media.tv.TvInputService" />
            </intent-filter>

            <meta-data
                android:name="android.media.tv.input"
                android:resource="@xml/tv_input_service" />
        </service>
        <service
            android:name="com.streamvault.app.service.DownloadForegroundService"
            android:exported="false"
            android:foregroundServiceType="dataSync" />

        <meta-data
            android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
            android:value="com.streamvault.app.cast.StreamVaultCastOptionsProvider" />

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="com.streamvault.app.debug.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true" >
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths" />
        </provider>

        <service
            android:name="com.streamvault.data.manager.recording.RecordingForegroundService"
            android:exported="false"
            android:foregroundServiceType="dataSync" />

        <receiver
            android:name="com.streamvault.data.manager.recording.RecordingAlarmReceiver"
            android:exported="false" />
        <receiver
            android:name="com.streamvault.data.manager.reminder.ProgramReminderAlarmReceiver"
            android:exported="false" />
        <receiver
            android:name="com.streamvault.data.manager.recording.RecordingRestoreReceiver"
            android:enabled="true"
            android:exported="true" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            </intent-filter>
        </receiver>
        <receiver
            android:name="com.streamvault.data.manager.reminder.ProgramReminderRestoreReceiver"
            android:enabled="true"
            android:exported="true" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            </intent-filter>
        </receiver>

        <provider
            android:name="androidx.startup.InitializationProvider"
            android:authorities="com.streamvault.app.debug.androidx-startup"
            android:exported="false" >
            <meta-data
                android:name="androidx.work.WorkManagerInitializer"
                android:value="androidx.startup" />
            <meta-data
                android:name="androidx.emoji2.text.EmojiCompatInitializer"
                android:value="androidx.startup" />
            <meta-data
                android:name="androidx.lifecycle.ProcessLifecycleInitializer"
                android:value="androidx.startup" />
            <meta-data
                android:name="androidx.profileinstaller.ProfileInstallerInitializer"
                android:value="androidx.startup" />
        </provider>

        <service
            android:name="androidx.work.impl.background.systemjob.SystemJobService"
            android:directBootAware="false"
            android:enabled="@bool/enable_system_job_service_default"
            android:exported="true"
            android:permission="android.permission.BIND_JOB_SERVICE" />
        <service
            android:name="androidx.work.impl.foreground.SystemForegroundService"
            android:directBootAware="false"
            android:enabled="@bool/enable_system_foreground_service_default"
            android:exported="false" />

        <receiver
            android:name="androidx.work.impl.utils.ForceStopRunnable$BroadcastReceiver"
            android:directBootAware="false"
            android:enabled="true"
            android:exported="false" />
        <receiver
            android:name="androidx.work.impl.background.systemalarm.RescheduleReceiver"
            android:directBootAware="false"
            android:enabled="false"
            android:exported="false" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
        <receiver
            android:name="androidx.work.impl.diagnostics.DiagnosticsReceiver"
            android:directBootAware="false"
            android:enabled="true"
            android:exported="true"
            android:permission="android.permission.DUMP" >
            <intent-filter>
                <action android:name="androidx.work.diagnostics.REQUEST_DIAGNOSTICS" />
            </intent-filter>
        </receiver>

        <service
            android:name="androidx.room.MultiInstanceInvalidationService"
            android:directBootAware="true"
            android:exported="false" />

        <receiver
            android:name="com.google.android.gms.cast.framework.media.MediaIntentReceiver"
            android:exported="false" />

        <service
            android:name="com.google.android.gms.cast.framework.ReconnectionService"
            android:exported="false" />

        <activity
            android:name="com.google.android.gms.auth.api.signin.internal.SignInHubActivity"
            android:excludeFromRecents="true"
            android:exported="false"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />
        <!--
            Service handling Google Sign-In user revocation. For apps that do not integrate with
            Google Sign-In, this service will never be started.
        -->
        <service
            android:name="com.google.android.gms.auth.api.signin.RevocationBoundService"
            android:exported="true"
            android:permission="com.google.android.gms.auth.api.signin.permission.REVOCATION_NOTIFICATION"
            android:visibleToInstantApps="true" />

        <activity
            android:name="com.google.android.gms.common.api.GoogleApiActivity"
            android:exported="false"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <activity
            android:name="androidx.compose.ui.tooling.PreviewActivity"
            android:exported="true" />

        <uses-library
            android:name="androidx.window.extensions"
            android:required="false" />
        <uses-library
            android:name="androidx.window.sidecar"
            android:required="false" />

        <activity
            android:name="androidx.activity.ComponentActivity"
            android:exported="true"
            android:theme="@android:style/Theme.Material.Light.NoActionBar" />

        <provider
            android:name="leakcanary.internal.LeakCanaryFileProvider"
            android:authorities="com.squareup.leakcanary.fileprovider.com.streamvault.app.debug"
            android:exported="false"
            android:grantUriPermissions="true" >
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/leak_canary_file_paths" />
        </provider>

        <activity
            android:name="leakcanary.internal.activity.LeakActivity"
            android:exported="true"
            android:icon="@mipmap/leak_canary_icon"
            android:label="@string/leak_canary_display_activity_label"
            android:taskAffinity="com.squareup.leakcanary.com.streamvault.app.debug"
            android:theme="@style/leak_canary_LeakCanary.Base" >
            <intent-filter android:label="@string/leak_canary_import_hprof_file" >
                <action android:name="android.intent.action.VIEW" />

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

                <data android:scheme="file" />
                <data android:scheme="content" />
                <data android:mimeType="*/*" />
                <data android:host="*" />
                <data android:pathPattern=".*\\.hprof" />
                <data android:pathPattern=".*\\..*\\.hprof" />
                <data android:pathPattern=".*\\..*\\..*\\.hprof" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\.hprof" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.hprof" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.hprof" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.hprof" />
                <!--
            Since hprof isn't a standard MIME type, we have to declare such patterns.
            Most file providers will generate URIs including their own package name,
            which contains `.` characters that must be explicitly escaped in pathPattern.
            @see https://stackoverflow.com/a/31028507/703646
                -->
            </intent-filter>
        </activity>

        <activity-alias
            android:name="leakcanary.internal.activity.LeakLauncherActivity"
            android:banner="@drawable/leak_canary_tv_icon"
            android:enabled="@bool/leak_canary_add_launcher_icon"
            android:exported="true"
            android:icon="@mipmap/leak_canary_icon"
            android:label="@string/leak_canary_display_activity_label"
            android:targetActivity="leakcanary.internal.activity.LeakActivity"
            android:taskAffinity="com.squareup.leakcanary.com.streamvault.app.debug"
            android:theme="@style/leak_canary_LeakCanary.Base" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
                <!-- Android TV launcher intent -->
                <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity
            android:name="leakcanary.internal.RequestPermissionActivity"
            android:excludeFromRecents="true"
            android:icon="@mipmap/leak_canary_icon"
            android:label="@string/leak_canary_storage_permission_activity_label"
            android:taskAffinity="com.squareup.leakcanary.com.streamvault.app.debug"
            android:theme="@style/leak_canary_Theme.Transparent" />

        <receiver android:name="leakcanary.internal.NotificationReceiver" />

        <provider
            android:name="leakcanary.internal.MainProcessAppWatcherInstaller"
            android:authorities="com.streamvault.app.debug.leakcanary-installer"
            android:enabled="@bool/leak_canary_watcher_auto_install"
            android:exported="false" />
        <provider
            android:name="leakcanary.internal.PlumberInstaller"
            android:authorities="com.streamvault.app.debug.plumber-installer"
            android:enabled="@bool/leak_canary_plumber_auto_install"
            android:exported="false" />

        <receiver
            android:name="androidx.profileinstaller.ProfileInstallReceiver"
            android:directBootAware="false"
            android:enabled="true"
            android:exported="true"
            android:permission="android.permission.DUMP" >
            <intent-filter>
                <action android:name="androidx.profileinstaller.action.INSTALL_PROFILE" />
            </intent-filter>
            <intent-filter>
                <action android:name="androidx.profileinstaller.action.SKIP_FILE" />
            </intent-filter>
            <intent-filter>
                <action android:name="androidx.profileinstaller.action.SAVE_PROFILE" />
            </intent-filter>
            <intent-filter>
                <action android:name="androidx.profileinstaller.action.BENCHMARK_OPERATION" />
            </intent-filter>
        </receiver>

        <service
            android:name="com.google.android.datatransport.runtime.backends.TransportBackendDiscovery"
            android:exported="false" >
            <meta-data
                android:name="backend:com.google.android.datatransport.cct.CctBackendFactory"
                android:value="cct" />
        </service>
        <service
            android:name="com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService"
            android:exported="false"
            android:permission="android.permission.BIND_JOB_SERVICE" >
        </service>

        <receiver
            android:name="com.google.android.datatransport.runtime.scheduling.jobscheduling.AlarmManagerSchedulerBroadcastReceiver"
            android:exported="false" />
    </application>

</manifest>