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

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

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

    <application
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:theme="@style/NoActionBar"
        android:name=".app.UApp"
        android:label="@string/common.appname"
        android:usesCleartextTraffic="true">

        <meta-data android:name="com.google.android.gms.car.application"
            android:resource="@xml/automotive_app_desc"/>

        <!--Used by Android Auto-->
        <meta-data android:name="com.google.android.gms.car.notification.SmallIcon"
            android:resource="@mipmap/ic_launcher" />

        <activity android:name=".activity.NavigationActivity"
            android:configChanges="orientation|keyboardHidden"
            android:label="@string/common.appname"
            android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.SEARCH"/>
                <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH"/>

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <nav-graph android:value="@navigation/navigation_graph" />
            <meta-data
                android:name="android.app.searchable"
                android:resource="@xml/searchable"/>
        </activity>

        <service
            android:name=".service.MediaPlayerService"
            android:label="Ultrasonic Media Player Service"
            android:exported="false">
        </service>

        <service
            tools:ignore="ExportedService"
            android:name=".service.AutoMediaBrowserService"
            android:label="@string/common.appname"
            android:exported="true">

            <intent-filter>
                <action android:name="android.media.browse.MediaBrowserService" />
            </intent-filter>
        </service>

        <receiver android:name=".receiver.MediaButtonIntentReceiver">
            <intent-filter android:priority="2147483647">
                <action android:name="android.intent.action.MEDIA_BUTTON"/>
            </intent-filter>
        </receiver>
        <receiver android:name=".receiver.UltrasonicIntentReceiver">
            <intent-filter>
                <action android:name="org.moire.ultrasonic.CMD_TOGGLEPAUSE"/>
                <action android:name="org.moire.ultrasonic.CMD_PLAY"/>
                <action android:name="org.moire.ultrasonic.CMD_RESUME_OR_PLAY"/>
                <action android:name="org.moire.ultrasonic.CMD_PAUSE"/>
                <action android:name="org.moire.ultrasonic.CMD_NEXT"/>
                <action android:name="org.moire.ultrasonic.CMD_PREVIOUS"/>
                <action android:name="org.moire.ultrasonic.CMD_STOP"/>
                <action android:name="org.moire.ultrasonic.CMD_PROCESS_KEYCODE"/>
            </intent-filter>
        </receiver>
        <receiver android:name=".receiver.BluetoothIntentReceiver">
            <intent-filter>
                <action android:name="android.bluetooth.device.action.ACL_CONNECTED"/>
                <action android:name="android.bluetooth.device.action.ACL_DISCONNECTED"/>
                <action android:name="android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED"/>
                <action android:name="android.bluetooth.a2dp.profile.action.CONNECTION_STATE_CHANGED"/>
            </intent-filter>
        </receiver>
        <receiver
            android:name=".provider.UltrasonicAppWidgetProvider4X1"
            android:label="Ultrasonic (4x1)">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/appwidget_info_4x1"/>
        </receiver>
        <receiver
            android:name=".provider.UltrasonicAppWidgetProvider4X2"
            android:label="Ultrasonic (4x2)">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/appwidget_info_4x2"/>
        </receiver>
        <receiver
            android:name=".provider.UltrasonicAppWidgetProvider4X3"
            android:label="Ultrasonic (4x3)">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/appwidget_info_4x3"/>
        </receiver>
        <receiver
            android:name=".provider.UltrasonicAppWidgetProvider4X4"
            android:label="Ultrasonic (4x4)">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/appwidget_info_4x4"/>
        </receiver>

        <provider
            android:name=".provider.SearchSuggestionProvider"
            android:authorities="org.moire.ultrasonic.provider.SearchSuggestionProvider"/>

        <receiver
            android:name=".receiver.A2dpIntentReceiver"
            android:exported="false">
            <intent-filter>
                <action android:name="com.android.music.playstatusrequest"/>
            </intent-filter>
        </receiver>
    </application>

</manifest>
