<!--
    Created by Angel Leon (@gubatron), Alden Torres (aldenml)
    Copyright (c) 2011-2026, FrostWire(R). All rights reserved.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:installLocation="auto"
        android:versionCode="769"
        android:versionName="3.0.15">
    <!-- IMPORTANT!! Ignore these, just use as a reference, now it's handled with gradle -->
    <!-- Plus  android:versionCode="9070xyz" (always commit like this, plus!)-->
    <!-- Basic android:versionCode="9060xyz" (don't commit like this) -->
    <!-- Plus version example  for 1.7.2 build 242  -> 9050242 -->
    <!-- Basic version example for 1.7.2 build 242  -> 9010242 -->
    <!-- Don't go nuts, max version number will be: 2,147,483,647 -->

    <!-- low level networking -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
    <!-- storage -->

    <!-- new in Android 13, sdk 33 -->
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />

    <!-- new in Android 14, SDK 34 -->
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />

    <!-- External refers not to SD Cards, but to SHARED files outside our app's
         internal storage -->

    <!-- READ_EXTERNAL_STORAGE should allow us to read media files from other apps,
         this should be useful for My Files to at least browse, and open files,
         but we will no longer have the power to remove files.
         Google Play grants special apps only with WRITE_EXTERNAL_STORAGE permissions

         The File api comes back in Android 11, however it's really a wrapper
         for accessing the shared external storage and performance will suffer if you
         open and close the same files multiple times.
         -->
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <!-- we gotta leave this here for Android 7.0 (24), 7.1.1 (25), 8.0 (26), 8.1 (27), 9 (28), 10 (29) -->
    <uses-permission
            android:name="android.permission.WRITE_EXTERNAL_STORAGE"
            android:maxSdkVersion="29"
            android:requestLegacyExternalStorage="true"
            tools:ignore="ScopedStorage" />

    <!-- generic -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SET_WALLPAPER" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.BROADCAST_STICKY" />
    <uses-permission android:name="android.permission.READ_CLIPBOARD" />

    <!-- extra -->
    <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

    <application
            android:name="org.team_hermes.wireshare.android.gui.MainApplication"
            android:allowBackup="false"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/application_label"
            android:theme="@style/Theme.WireShare">

        <!-- Disable automatic WorkManager initialization to use our custom configuration -->
        <provider
                android:name="androidx.startup.InitializationProvider"
                android:authorities="${applicationId}.androidx-startup"
                android:exported="false"
                tools:node="merge">
            <meta-data
                    android:name="androidx.work.WorkManagerInitializer"
                    android:value="androidx.startup"
                    tools:node="remove" />
        </provider>

        <!-- activities -->

        <activity
                android:name="org.team_hermes.wireshare.android.gui.activities.MainActivity"
                android:launchMode="singleTask"
                android:protectionLevel="dangerous"
                android:theme="@style/SplashScreenTheme"
                android:screenOrientation="portrait"
                android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.MUSIC_PLAYER" />

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

            <!-- handle .torrent urls, files and magnets -->
            <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="magnet" />
                <data android:host="*" />
            </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/x-bittorrent" />
                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:scheme="file" />
                <data android:scheme="content" />
                <data android:host="*" />
            </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="*/*" />
                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:scheme="file" />
                <data android:scheme="content" />
                <data android:host="*" />
                <data android:pathPattern=".*\\.torrent" />
                <data android:pathPattern=".*\\..*\\.torrent" />
                <data android:pathPattern=".*\\..*\\..*\\.torrent" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\.torrent" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.torrent" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.torrent" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.torrent" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\.torrent" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\.torrent" />
            </intent-filter>
        </activity>
        <activity
                android:name="org.team_hermes.wireshare.android.gui.activities.WizardActivity"
                android:screenOrientation="portrait"
                android:theme="@style/WizardActivity" />
        <activity
                android:name="org.team_hermes.wireshare.android.gui.activities.SettingsActivity"
                android:screenOrientation="portrait"
                android:label="@string/activity_preferences_name" />
        <activity
                android:name="org.team_hermes.wireshare.android.gui.activities.AboutActivity"
                android:screenOrientation="portrait"
                android:label="@string/about" />
        <activity
                android:name="org.team_hermes.wireshare.android.gui.activities.PreviewPlayerActivity"
                android:screenOrientation="portrait"
                android:configChanges="screenSize"
                android:label="@string/playing" />
        <activity
                android:name="org.team_hermes.wireshare.android.gui.activities.VPNStatusDetailActivity"
                android:screenOrientation="portrait"
                android:excludeFromRecents="true"
                android:label="@string/activity_VPN"
                android:noHistory="true" />
        <activity
                android:name="org.team_hermes.wireshare.android.gui.activities.TransferDetailActivity"
                android:screenOrientation="portrait"
                android:label="@string/title_activity_transfer_detail" />

        <!-- apollo activities -->
        <activity
                android:name="com.andrew.apollo.ui.activities.HomeActivity"
                android:screenOrientation="portrait"
                android:windowSoftInputMode="adjustPan" />
        <activity
                android:name="com.andrew.apollo.ui.activities.AudioPlayerActivity"
                android:screenOrientation="portrait"
                android:clearTaskOnLaunch="true"
                android:label="@string/frostwire_player"
                android:launchMode="singleTask"
                android:windowSoftInputMode="adjustPan"
                android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

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

                <data android:scheme="content" />
                <data android:mimeType="audio/*" />
                <data android:mimeType="application/ogg" />
                <data android:mimeType="application/x-ogg" />
                <data android:mimeType="application/itunes" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

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

                <data android:scheme="file" />
                <data android:mimeType="audio/*" />
                <data android:mimeType="application/ogg" />
                <data android:mimeType="application/x-ogg" />
                <data android:mimeType="application/itunes" />
            </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="http" />
                <data android:mimeType="audio/*" />
                <data android:mimeType="application/ogg" />
                <data android:mimeType="application/x-ogg" />
                <data android:mimeType="application/itunes" />
            </intent-filter>
            <intent-filter
                    android:scheme="http"
                    tools:ignore="AppLinkUrlError">
                <action android:name="android.intent.action.VIEW" />

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

                <data android:mimeType="vnd.android.cursor.dir/playlist" />
                <data android:mimeType="vnd.android.cursor.dir/albums" />
                <data android:mimeType="vnd.android.cursor.dir/artists" />
            </intent-filter>
            <intent-filter>
                <action android:name="org.team_hermes.wireshare.android.AUDIO_PLAYER" />

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

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

                <data android:mimeType="vnd.android.cursor.dir/audio" />
            </intent-filter>
        </activity>
        <activity
                android:name="com.andrew.apollo.ui.activities.ProfileActivity"
                android:screenOrientation="portrait"
                android:excludeFromRecents="true" />
        <activity
                android:name="com.andrew.apollo.ui.activities.ShortcutActivity"
                android:screenOrientation="portrait"
                android:excludeFromRecents="true"
                android:theme="@style/Theme.Transparent"
                android:exported="true">
            <intent-filter>
                <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
                android:name="com.andrew.apollo.ui.activities.SearchActivity"
                android:screenOrientation="portrait"
                android:parentActivityName="com.andrew.apollo.ui.activities.HomeActivity"
                android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
                <action android:name="android.intent.action.MEDIA_SEARCH" />

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

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

        <service
                android:name="org.team_hermes.wireshare.android.gui.services.EngineForegroundService"
                android:foregroundServiceType="dataSync"
                android:exported="false" />
        <service
                android:name="com.andrew.apollo.MusicPlaybackService"
                android:foregroundServiceType="mediaPlayback"
                android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MEDIA_BUTTON" />
                <action android:name="androidx.media3.session.MediaSessionService" />
            </intent-filter>
        </service>

        <!-- receivers -->

        <receiver
                android:name="org.team_hermes.wireshare.android.gui.services.EngineBroadcastReceiver"
                android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

        <!-- providers -->
        <provider
                android:name="androidx.core.content.FileProvider"
                android:authorities="${applicationId}.fileprovider"
                android:exported="false"
                android:grantUriPermissions="true">
            <meta-data
                    android:name="android.support.FILE_PROVIDER_PATHS"
                    android:resource="@xml/file_paths" />
        </provider>

    </application>
</manifest>
