<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2023 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          package="com.android.systemui"
          android:sharedUserId="android.uid.systemui"
          coreApp="true">

    <!-- Permission to assign Activity to TDA -->
    <uses-permission android:name="android.car.permission.CONTROL_CAR_APP_LAUNCH"/>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <!-- System permission to call AM.getRunningAppProcesses().
     TODO: change this to REAL_GET_TASKS. -->
    <uses-permission android:name="android.permission.GET_TASKS"/>
    <uses-permission android:name="android.car.permission.CONTROL_CAR_APP_LAUNCH"/>

    <!-- This permission is required to create a CarTaskViewController -->
    <uses-permission android:name="android.car.permission.MANAGE_CAR_SYSTEM_UI"/>
    <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />
    <uses-permission android:name="android.permission.CAPTURE_SECURE_VIDEO_OUTPUT" />

    <!-- Permission to get car driving state -->
    <uses-permission android:name="android.car.permission.CAR_DRIVING_STATE"/>
    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/>

    <!-- Permission to get outside temperature -->
    <uses-permission android:name="android.car.permission.CAR_EXTERIOR_ENVIRONMENT"/>
    <uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL"/>
    <uses-permission android:name="android.permission.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY"/>

    <protected-broadcast android:name="REQUEST_FROM_SYSTEM_UI" />
    <application
        tools:replace="android:appComponentFactory"
        android:appComponentFactory="com.android.systemui.SystemUIAppComponentFactory">
        <activity
            android:name=".car.distantdisplay.activity.DistantDisplayCompanionActivity"
            android:documentLaunchMode="always"
            android:excludeFromRecents="true"
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
            android:exported="false"
            android:showForAllUsers="true"
            android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
            </intent-filter>
        </activity>
        <activity
            android:name=".car.distantdisplay.activity.DistantDisplayGameController"
            android:documentLaunchMode="always"
            android:excludeFromRecents="true"
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
            android:exported="true"
            android:showForAllUsers="true"
            android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
            </intent-filter>
        </activity>
        <activity
            android:name=".car.distantdisplay.activity.NavigationTaskViewWallpaperActivity"
            android:exported="true"
            android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
            android:documentLaunchMode="always"
            android:excludeFromRecents="true">
            <meta-data android:name="distractionOptimized" android:value="true"/>
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
            </intent-filter>
        </activity>
        <activity
            android:name=".car.distantdisplay.activity.RootTaskViewWallpaperActivity"
            android:exported="true"
            android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
            android:documentLaunchMode="never"
            android:excludeFromRecents="true">
            <meta-data android:name="distractionOptimized" android:value="true"/>
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
            </intent-filter>
        </activity>
        <receiver
            android:name=".car.distantdisplay.activity.MoveTaskReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="com.android.systemui.car.intent.action.MOVE_TASK"/>
            </intent-filter>
        </receiver>
        <receiver
            android:name=".car.distantdisplay.common.DistantDisplayReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="com.android.systemui.car.intent.action.DISTANT_DISPLAY"/>
            </intent-filter>
        </receiver>
        <service
            android:name="com.android.systemui.car.appcard.AppCardService"
            android:enabled="true"
            android:singleUser="true"
            android:permission="android.car.permission.BIND_APP_CARD_PROVIDER"
            android:exported="true">
            <intent-filter>
                <action android:name="com.android.systemui.car.appcard.AppCardService" />
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>
    </application>
</manifest>
