<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:installLocation="auto">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:xlargeScreens="true"/>

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

    <application
        android:name="de.danoeh.antennapod.PodcastApp"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:backupAgent=".storage.importexport.OpmlBackupAgent"
        android:restoreAnyVersion="true"
        android:theme="@style/Theme.AntennaPod.Splash"
        android:usesCleartextTraffic="true"
        android:supportsRtl="true"
        android:logo="@mipmap/ic_launcher"
        android:resizeableActivity="true"
        android:allowAudioPlaybackCapture="true"
        android:enableOnBackInvokedCallback="true"
        android:localeConfig="@xml/locale_config"
        android:networkSecurityConfig="@xml/network_security_config">

        <activity
            android:name=".ui.screen.playback.PlaybackSpeedDialogActivity"
            android:noHistory="true"
            android:exported="false"
            android:excludeFromRecents="true"
            android:theme="@style/Theme.AntennaPod.Splash.Translucent">
            <intent-filter>
                <action android:name="de.danoeh.antennapod.intents.PLAYBACK_SPEED" />
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>

        <meta-data android:name="android.webkit.WebView.MetricsOptOut"
            android:value="true"/>
        <meta-data android:name="com.google.android.gms.car.notification.SmallIcon"
            android:resource="@drawable/ic_notification"/>
        <meta-data
            android:name="com.google.android.gms.car.application"
            android:resource="@xml/automotive_app_desc"/>
        <meta-data
            android:name="com.google.android.backup.api_key"
            android:value="AEdPqrEAAAAI3a05VToCTlqBymJrbFGaKQMvF-bBAuLsOdavBA"/>
        <meta-data
            android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
            android:value="de.danoeh.antennapod.playback.cast.CastOptionsProvider" />

        <!-- Version < 3.0. DeX Mode and Screen Mirroring support -->
        <meta-data android:name="com.samsung.android.keepalive.density" android:value="true"/>
        <!-- Version >= 3.0. DeX Dual Mode support -->
        <meta-data android:name="com.samsung.android.multidisplay.keep_process_alive" android:value="true"/>

        <activity
            android:name=".activity.SplashActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
                <action android:name="android.intent.action.MUSIC_PLAYER" />

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

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

        <activity
            android:name=".activity.MainActivity"
            android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|density|uiMode|keyboard|navigation"
            android:windowSoftInputMode="stateAlwaysHidden"
            android:launchMode="singleTask"
            android:exported="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:host="antennapod.org"
                    android:pathPrefix="/deeplink/main"
                    android:scheme="https" />
            </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:host="antennapod.org"
                    android:pathPrefix="/deeplink/search"
                    android:scheme="https" />
            </intent-filter>
            <intent-filter>
                <category android:name="android.intent.category.DEFAULT" />
                <action android:name="de.danoeh.antennapod.intents.MAIN_ACTIVITY" />
                <action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES"/>
            </intent-filter>
        </activity>

        <activity
            android:name=".ui.screen.preferences.PreferenceActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:exported="false"
            android:label="@string/settings_label">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="de.danoeh.antennapod.activity.MainActivity"/>
            <intent-filter>
                <action android:name="android.intent.action.APPLICATION_PREFERENCES" />
            </intent-filter>
        </activity>

        <activity
            android:name=".activity.OpmlImportActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/opml_import_label"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <action android:name="android.intent.action.SEND"/>

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

                <data android:mimeType="text/xml"/>
                <data android:mimeType="text/x-opml"/>
                <data android:mimeType="application/xml"/>

                <data android:scheme="file"/>
                <data android:scheme="content"/>
                <data android:scheme="http"/>
                <data android:scheme="https"/>
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.screen.preferences.BugReportActivity"
            android:label="@string/bug_report_title">
            <meta-data
                    android:name="android.support.PARENT_ACTIVITY"
                    android:value="de.danoeh.antennapod.ui.screen.preferences.PreferenceActivity"/>
        </activity>

        <activity
            android:name=".ui.screen.playback.video.VideoplayerActivity"
            android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
            android:supportsPictureInPicture="true"
            android:screenOrientation="sensorLandscape"
            android:exported="false"
            tools:ignore="DiscouragedApi">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="de.danoeh.antennapod.activity.MainActivity"/>
            <intent-filter>
                <action android:name="de.danoeh.antennapod.intents.VIDEO_PLAYER" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity
            android:name=".ui.screen.onlinefeedview.OnlineFeedViewActivity"
            android:configChanges="orientation|screenSize"
            android:theme="@style/Theme.AntennaPod.Splash.Translucent"
            android:label="@string/add_feed_label"
            android:exported="true">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="de.danoeh.antennapod.activity.MainActivity"/>

            <!-- Files with mimeType rss/xml/atom -->
            <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="http"/>
                <data android:scheme="https"/>
                <data android:mimeType="text/xml"/>
                <data android:mimeType="application/rss+xml"/>
                <data android:mimeType="application/atom+xml"/>
                <data android:mimeType="application/xml"/>
            </intent-filter>

            <!-- Podcast protocols -->
            <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="itpc"/>
                <data android:scheme="pcast"/>
                <data android:scheme="feed"/>
                <data android:scheme="antennapod-subscribe"/>
            </intent-filter>

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

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

                <data android:host="antennapod.org" />
                <data android:pathPrefix="/deeplink/subscribe" />
                <data android:scheme="http" />
                <data android:scheme="https" />
            </intent-filter>

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

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

                <data android:pathPattern="/.*\\..*/.*" />
                <data android:host="www.subscribeonandroid.com" />
                <data android:scheme="https" />
            </intent-filter>

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

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

                <data android:mimeType="text/plain"/>
            </intent-filter>

            <intent-filter>
                <category android:name="android.intent.category.DEFAULT" />
                <action android:name="de.danoeh.antennapod.intents.ONLINE_FEEDVIEW" />
            </intent-filter>
        </activity>

        <activity android:name=".activity.SelectSubscriptionActivity"
            android:label="@string/shortcut_subscription_label"
            android:icon="@drawable/ic_shortcut_subscriptions"
            android:theme="@style/Theme.AntennaPod.Splash.Translucent"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.CREATE_SHORTCUT" />
            </intent-filter>
        </activity>

        <provider
            android:authorities="@string/provider_authority"
            android:name="androidx.core.content.FileProvider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths"/>
        </provider>

        <meta-data
            tools:ignore="Deprecated"
            android:name="com.google.android.actions"
            android:resource="@xml/actions" />
    </application>

</manifest>
