<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2015 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.
-->
<!-- This manifest is for LiveTv -->

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

    <queries>
        <intent>
            <action android:name="android.intent.action.MAIN" />
        </intent>
        <intent>
            <action android:name="android.media.tv.TvInputService" />
        </intent>
        <intent>
            <action android:name="android.media.tv.action.QUERY_CONTENT_RATING_SYSTEMS" />
        </intent>
    </queries>

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.CHANGE_HDMI_CEC_ACTIVE_SOURCE"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
    <uses-permission android:name="android.permission.HDMI_CEC"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.MODIFY_PARENTAL_CONTROLS"/>
    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
    <uses-permission android:name="android.permission.READ_CONTENT_RATING_SYSTEMS"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_TV_LISTINGS"/>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.START_ACTIVITIES_FROM_BACKGROUND"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="com.android.providers.tv.permission.READ_EPG_DATA"/>
    <uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA"/>
    <uses-permission android:name="com.android.providers.tv.permission.ACCESS_ALL_EPG_DATA"/>
    <uses-permission android:name="com.android.providers.tv.permission.ACCESS_WATCHED_PROGRAMS"/>
    <!-- Permissions/feature for USB tuner -->
    <uses-permission android:name="android.permission.DVB_DEVICE"/>
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

    <uses-feature android:name="android.hardware.usb.host"
         android:required="false"/>

    <!-- Limit only for Android TV -->
    <uses-feature android:name="android.software.leanback"
         android:required="true"/>
    <uses-feature android:name="android.software.live_tv"
         android:required="true"/>
    <uses-feature android:name="android.hardware.touchscreen"
         android:required="false"/>

    <!-- Receives input events from the TV app. -->
    <permission android:name="com.android.tv.permission.RECEIVE_INPUT_EVENT"
         android:description="@string/permdesc_receiveInputEvent"
         android:label="@string/permlab_receiveInputEvent"
         android:protectionLevel="signatureOrSystem"/>
    <!-- Customizes Live TV with customization packages. -->
    <permission android:name="com.android.tv.permission.CUSTOMIZE_TV_APP"
         android:description="@string/permdesc_customizeTvApp"
         android:label="@string/permlab_customizeTvApp"
         android:protectionLevel="signatureOrSystem"/>

    <application android:name="com.android.tv.app.LiveTvApplication"
         android:allowBackup="true"
         android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
         android:banner="@drawable/live_tv_banner"
         android:icon="@drawable/ic_tv_app"
         android:label="@string/app_name"
         android:supportsRtl="true"
         android:theme="@style/Theme.TV"
         tools:replace="android:appComponentFactory">

        <provider android:name="com.android.tv.common.CommonPreferenceProvider"
             android:authorities="com.android.tv.common.preferences"
             android:exported="false"
             android:process="com.android.tv.common"/>



        <receiver android:name="com.android.tv.livetv.receiver.GlobalKeyReceiver"
             android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.GLOBAL_BUTTON"/>
            </intent-filter>

            <!-- Not directly related to GlobalKeyReceiver but needed to be able to provide our
                 content rating definitions to the system service.
            -->
            <intent-filter>
                <action android:name="android.media.tv.action.QUERY_CONTENT_RATING_SYSTEMS"/>
            </intent-filter>

            <meta-data android:name="android.media.tv.metadata.CONTENT_RATING_SYSTEMS"
                 android:resource="@xml/tv_content_rating_systems"/>
        </receiver>

        <activity android:name="com.android.tv.TvActivity"
             android:exported="true"
             android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.LAUNCHER"/>
                <category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity android:name="com.android.tv.LauncherActivity"
             android:exported="false"
             android:configChanges="keyboard|keyboardHidden"
             android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
        <activity android:name="com.android.tv.SetupPassthroughActivity"
             android:configChanges="keyboard|keyboardHidden"
             android:exported="true"
             android:theme="@android:style/Theme.Translucent.NoTitleBar">
            <intent-filter>
                <action android:name="com.android.tv.action.LAUNCH_INPUT_SETUP"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:name="com.android.tv.SelectInputActivity"
             android:exported="true"
             android:label="@string/select_inputs"
             android:configChanges="keyboard|keyboardHidden"
             android:launchMode="singleTask"
             android:theme="@style/Theme.SelectInputActivity">
            <intent-filter>
                <action android:name="com.android.tv.action.VIEW_INPUTS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity android:name="com.android.tv.onboarding.OnboardingActivity"
             android:exported="false"
             android:configChanges="keyboard|keyboardHidden"
             android:launchMode="singleTop"
             android:theme="@style/Theme.Setup.GuidedStep"/>
        <activity android:name="com.android.tv.dvr.ui.browse.DvrBrowseActivity"
             android:configChanges="keyboard|keyboardHidden"
             android:launchMode="singleTask"
             android:theme="@style/Theme.Leanback.Browse"
             android:exported="true">
            <intent-filter>
                <action android:name="android.media.tv.action.VIEW_RECORDING_SCHEDULES"/>

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

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

                <data android:mimeType="vnd.android.cursor.dir/recorded_program"/>
            </intent-filter>
        </activity>
        <activity android:name="com.android.tv.dvr.ui.playback.DvrPlaybackActivity"
             android:configChanges="keyboard|keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
             android:launchMode="singleTask"
             android:theme="@style/Theme.Leanback"
             android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>

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

                <data android:mimeType="vnd.android.cursor.item/recorded_program"/>
            </intent-filter>
        </activity>
        <activity android:name="com.android.tv.ui.DetailsActivity"
             android:configChanges="keyboard|keyboardHidden"
             android:exported="true"
             android:theme="@style/Theme.TV.Dvr.Browse.Details"/>
        <activity android:name="com.android.tv.dvr.ui.DvrRecordingSettingsActivity"
             android:configChanges="keyboard|keyboardHidden"
             android:exported="false"
             android:theme="@style/Theme.TV.Dvr.Series.Settings.GuidedStep"/>
        <activity android:name="com.android.tv.dvr.ui.DvrSeriesSettingsActivity"
             android:configChanges="keyboard|keyboardHidden"
             android:exported="false"
             android:theme="@style/Theme.TV.Dvr.Series.Settings.GuidedStep"/>
        <activity android:name="com.android.tv.dvr.ui.DvrSeriesDeletionActivity"
             android:configChanges="keyboard|keyboardHidden"
             android:exported="false"
             android:theme="@style/Theme.TV.Dvr.Series.Deletion.GuidedStep"/>
        <activity android:name="com.android.tv.dvr.ui.DvrSeriesScheduledDialogActivity"
             android:exported="false"
             android:theme="@style/Theme.TV.dialog.HalfSizedDialog"/>
        <activity android:name="com.android.tv.dvr.ui.list.DvrSchedulesActivity"
             android:configChanges="keyboard|keyboardHidden"
             android:exported="false"
             android:theme="@style/Theme.Leanback.Details"/>
        <activity android:name="com.android.tv.dvr.ui.list.DvrHistoryActivity"
             android:configChanges="keyboard|keyboardHidden"
             android:exported="false"
             android:theme="@style/Theme.Leanback.Details"/>

        <service android:name="com.android.tv.recommendation.NotificationService"
             android:exported="false"/>
        <service android:name="com.android.tv.recommendation.ChannelPreviewUpdater$ChannelPreviewUpdateService"
             android:exported="false"
             android:permission="android.permission.BIND_JOB_SERVICE"/>

        <receiver android:name="com.android.tv.receiver.BootCompletedReceiver"
             android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
            </intent-filter>
        </receiver>
        <receiver android:name="com.android.tv.receiver.PackageIntentsReceiver"
             android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_ADDED"/>
                <!-- PACKAGE_CHANGED for package enabled/disabled notification -->
                <action android:name="android.intent.action.PACKAGE_CHANGED"/>
                <action android:name="android.intent.action.PACKAGE_FULLY_REMOVED"/>
                <action android:name="android.intent.action.PACKAGE_REMOVED"/>

                <data android:scheme="package"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
            </intent-filter>
        </receiver> <!-- System initial setup component definition -->
        <activity android:name="com.android.tv.setup.SystemSetupActivity"
             android:configChanges="keyboard|keyboardHidden"
             android:exported="true"
             android:label="@string/app_name"
             android:launchMode="singleInstance"
             android:theme="@style/Theme.Setup.GuidedStep">
            <intent-filter>
                <action android:name="com.android.tv.action.LAUNCH_SYSTEM_SETUP"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity> <!-- DVR -->
        <service android:name="com.android.tv.dvr.recorder.DvrRecordingService"
             android:foregroundServiceType="mediaPlayback"
             android:exported="false"
             android:label="@string/dvr_service_name"/>

        <receiver android:name="com.android.tv.dvr.recorder.DvrStartRecordingReceiver"
             android:exported="false"/>

        <service android:name="com.android.tv.data.epg.EpgFetchService"
             android:exported="false"
             android:permission="android.permission.BIND_JOB_SERVICE"/>
    </application>

</manifest>
