<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <!-- Google Services разрешения (опциональные) -->
    <uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="replace"/>
    <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>

    <application
        android:name=".URLRadio"
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:localeConfig="@xml/locales_config"
        android:networkSecurityConfig="@xml/network_security_config"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true"
        android:enableOnBackInvokedCallback="true"
        tools:targetApi="tiramisu">

        <!-- Google Services meta-data (опциональные) -->
        <meta-data
            android:name="com.google.android.gms.car.application"
            android:resource="@xml/automotive_app_desc"
            tools:node="replace" />
        <meta-data
            android:name="com.google.android.gms.car.notification.SmallIcon"
            android:resource="@mipmap/ic_launcher"
            tools:node="replace" />

        <!-- Yandex Ads -->
        <meta-data
            android:name="com.yandex.mobile.ads.AUTOMATIC_SDK_INITIALIZATION"
            android:value="false" />

        <!-- Firebase meta-data (опциональные) -->
        <meta-data
            android:name="firebase_performance_logcat_enabled"
            android:value="true"
            tools:node="replace" />

        <activity
            android:name=".MainActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:exported="true"
            android:launchMode="singleTop">
            <intent-filter>
                <action android:name="OPEN_MAIN_ACTIVITY" />
                <category android:name="android.intent.category.DEFAULT" />
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
                    </intent-filter>
                </activity>

        <!--        <activity-->
<!--            android:name="com.yaros.RadioUrl.ui.SplashScreen"-->
<!--            android:configChanges="orientation|keyboardHidden|screenSize"-->
<!--            android:exported="true">-->
<!--            <intent-filter>-->
<!--                <action android:name="android.intent.action.MAIN" />-->
<!--                <category android:name="android.intent.category.LAUNCHER" />-->
<!--            </intent-filter>-->
<!--        </activity>-->

        <service
            android:name=".PlayerService"
            android:enabled="true"
            android:exported="true"
            android:foregroundServiceType="mediaPlayback">
            <intent-filter>
                <action android:name="androidx.media3.session.MediaSessionService" />
                <action android:name="android.media.browse.MediaBrowserService" />
                <action android:name="com.yaros.RadioUrl.action.START_PLAYER_SERVICE" />
            </intent-filter>
        </service>

        <!-- Firebase Messaging Service (опциональный - работает только если Firebase доступен) -->
        <service
            android:name=".helpers.FMessagingService"
            android:enabled="true"
            android:exported="false"
            tools:node="replace">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

        <!-- Firebase Messaging meta-data (опциональные) -->
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_launcher"
            tools:node="replace" />

        <meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/list_card_background"
            tools:node="replace" />

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true"
            tools:replace="android:authorities">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths"
                tools:replace="android:resource"/>
        </provider>
    </application>
</manifest>
