<?xml version="1.0" encoding="utf-8"?>
<!--
/*
 * Copyright (c) 2014 Google Inc.
 *
 * 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"
        package="com.android.systemui"
        android:sharedUserId="android.uid.systemui"
        coreApp="true">

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!-- Used to read storage for all users -->
    <uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <uses-permission android:name="android.permission.INJECT_EVENTS" />
    <uses-permission android:name="android.permission.DUMP" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />

    <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />
    <uses-permission android:name="android.permission.STATUS_BAR" />
    <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
    <uses-permission android:name="android.permission.REMOTE_AUDIO_PLAYBACK" />

    <uses-permission android:name="android.permission.MANAGE_USERS" />
    <uses-permission android:name="android.permission.READ_PROFILE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.CONFIGURE_WIFI_DISPLAY" />
    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
    <uses-permission android:name="android.permission.GET_APP_OPS_STATS" />

    <!-- Networking and telephony -->
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
    <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_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_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.OVERRIDE_WIFI_CONFIG" />
    <uses-permission android:name="android.permission.MANAGE_NETWORK_POLICY" />
    <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
    <uses-permission android:name="android.permission.TETHER_PRIVILEGED" />
    <uses-permission android:name="android.permission.READ_NETWORK_USAGE_HISTORY" />
    <uses-permission android:name="android.permission.CONTROL_VPN" />
    <uses-permission android:name="android.permission.PEERS_MAC_ADDRESS"/>
    <!-- Physical hardware -->
    <uses-permission android:name="android.permission.MANAGE_USB" />
    <uses-permission android:name="android.permission.DEVICE_POWER" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    <uses-permission android:name="android.permission.MASTER_CLEAR" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <!-- ActivityManager -->
    <uses-permission android:name="android.permission.REAL_GET_TASKS" />
    <uses-permission android:name="android.permission.GET_DETAILED_TASKS" />
    <uses-permission android:name="android.permission.REORDER_TASKS" />
    <uses-permission android:name="android.permission.REMOVE_TASKS" />
    <uses-permission android:name="android.permission.STOP_APP_SWITCHES" />
    <uses-permission android:name="android.permission.SET_SCREEN_COMPATIBILITY" />
    <uses-permission android:name="android.permission.START_ANY_ACTIVITY" />
    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
    <uses-permission android:name="android.permission.GET_TOP_ACTIVITY_INFO" />
    <uses-permission android:name="android.permission.MANAGE_ACTIVITY_STACKS" />
    <uses-permission android:name="android.permission.START_TASKS_FROM_RECENTS" />
    <uses-permission android:name="android.permission.GET_INTENT_SENDER_INTENT" />

    <!-- WindowManager -->
    <uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.READ_FRAME_BUFFER" />
    <uses-permission android:name="android.permission.MANAGE_APP_TOKENS" />
    <uses-permission android:name="android.permission.REGISTER_WINDOW_MANAGER_LISTENERS" />
    <uses-permission android:name="android.permission.SET_ORIENTATION" />
    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />

    <!-- DreamManager -->
    <uses-permission android:name="android.permission.READ_DREAM_STATE" />
    <uses-permission android:name="android.permission.WRITE_DREAM_STATE" />

    <!-- Alarm clocks -->
    <uses-permission android:name="com.android.alarm.permission.SET_ALARM" />

    <!-- Keyguard -->
    <uses-permission android:name="android.permission.CONTROL_KEYGUARD" />
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
    <uses-permission android:name="android.permission.BIND_DEVICE_ADMIN" />
    <uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
    <uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL" />
    <uses-permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE" />
    <uses-permission android:name="android.permission.TRUST_LISTENER" />
    <uses-permission android:name="android.permission.USE_FINGERPRINT" />
    <uses-permission android:name="android.permission.RESET_FINGERPRINT_LOCKOUT" />

    <!-- Needed for WallpaperManager.clear in ImageWallpaper.updateWallpaperLocked -->
    <uses-permission android:name="android.permission.SET_WALLPAPER"/>

    <!-- Recents -->
    <uses-permission android:name="android.permission.BIND_APPWIDGET" />

    <!-- Wifi Display -->
    <uses-permission android:name="android.permission.CONFIGURE_WIFI_DISPLAY" />

    <uses-permission android:name="android.permission.CAMERA" />

    <!-- Screen Capturing -->
    <uses-permission android:name="android.permission.MANAGE_MEDIA_PROJECTION" />

    <!-- Assist -->
    <uses-permission android:name="android.permission.ACCESS_VOICE_INTERACTION_SERVICE" />

    <!-- Listen for keyboard attachment / detachment -->
    <uses-permission android:name="android.permission.TABLET_MODE" />

    <!-- Self permission for internal broadcasts. -->
    <permission android:name="com.android.systemui.permission.SELF"
            android:protectionLevel="signature" />
    <uses-permission android:name="com.android.systemui.permission.SELF" />

    <!-- Adding Quick Settings tiles -->
    <uses-permission android:name="android.permission.BIND_QUICK_SETTINGS_TILE" />

    <!-- Block notifications inline notifications -->
    <uses-permission android:name="android.permission.UPDATE_APP_OPS_STATS" />

    <!-- Access battery information -->
    <uses-permission android:name="android.permission.BATTERY_STATS" />

    <!-- DevicePolicyManager get user restrictions -->
    <uses-permission android:name="android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS" />

    <!-- TV picture-in-picture -->
    <uses-permission android:name="android.permission.RECEIVE_MEDIA_RESOURCE_USAGE" />

    <!-- DND access -->
    <uses-permission android:name="android.permission.MANAGE_NOTIFICATIONS" />

    <!-- It's like, reality, but, you know, virtual -->
    <uses-permission android:name="android.permission.ACCESS_VR_MANAGER" />

    <!-- the ability to rename notifications posted by other apps -->
    <uses-permission android:name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME" />

    <!-- shortcut manager -->
    <uses-permission android:name="android.permission.RESET_SHORTCUT_MANAGER_THROTTLING" />

    <!-- permission necessary to hide non-system overlay windows from covering up the SystemUI -->
    <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" />

    <application
        android:name=".SystemUIApplication"
        android:persistent="true"
        android:allowClearUserData="false"
        android:allowBackup="false"
        android:hardwareAccelerated="true"
        android:label="@string/app_label"
        android:icon="@drawable/icon"
        android:process="com.android.systemui"
        android:supportsRtl="true"
        android:theme="@style/systemui_theme"
        android:defaultToDeviceProtectedStorage="true"
        android:directBootAware="true">
        <!-- Keep theme in sync with SystemUIApplication.onCreate().
             Setting the theme on the application does not affect views inflated by services.
             The application theme is set again from onCreate to take effect for those views. -->

        <!-- Broadcast receiver that gets the broadcast at boot time and starts
             up everything else.
             TODO: Should have an android:permission attribute
             -->
        <service android:name="SystemUIService"
            android:exported="true"
            />

        <!-- Recents depends on every user having their own SystemUI process, so on user switch,
             ensure that the process is created by starting this service.
             -->
        <service android:name="SystemUISecondaryUserService"
            android:exported="true"
            android:permission="com.android.systemui.permission.SELF" />


        <!-- started from PhoneWindowManager
             TODO: Should have an android:permission attribute -->
        <service android:name=".screenshot.TakeScreenshotService"
            android:process=":screenshot"
            android:exported="false" />

        <!-- Called from PhoneWindowManager -->
        <receiver android:name=".screenshot.ScreenshotServiceErrorReceiver"
            android:process=":screenshot"
            android:exported="false">
            <intent-filter>
                <action android:name="com.android.systemui.screenshot.SHOW_ERROR" />
            </intent-filter>
        </receiver>

        <service android:name=".ImageWallpaper"
                android:permission="android.permission.BIND_WALLPAPER"
                android:exported="true" />

        <activity android:name=".tuner.TunerActivity"
                  android:enabled="false"
                  android:icon="@drawable/tuner"
                  android:theme="@style/TunerSettings"
                  android:label="@string/system_ui_tuner"
                  android:process=":tuner"
                  android:exported="true">
            <intent-filter>
                <action android:name="com.android.settings.action.EXTRA_SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data android:name="com.android.settings.category"
                    android:value="com.android.settings.category.system" />
        </activity>

        <activity-alias android:name=".DemoMode"
                  android:targetActivity=".tuner.TunerActivity"
                  android:icon="@drawable/tuner"
                  android:theme="@style/TunerSettings"
                  android:label="@string/demo_mode"
                  android:process=":tuner"
                  android:exported="true">
            <intent-filter>
                <action android:name="com.android.settings.action.DEMO_MODE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity-alias>

        <!-- Service used by secondary users to register themselves with the system user. -->
        <service android:name=".recents.RecentsSystemUserService"
            android:exported="false"
            android:permission="com.android.systemui.permission.SELF" />

        <!-- Alternate Recents -->
        <activity android:name=".recents.RecentsActivity"
                  android:label="@string/accessibility_desc_recent_apps"
                  android:exported="false"
                  android:launchMode="singleInstance"
                  android:excludeFromRecents="true"
                  android:stateNotNeeded="true"
                  android:resumeWhilePausing="true"
                  android:screenOrientation="behind"
                  android:resizeableActivity="true"
                  android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden"
                  android:theme="@style/RecentsTheme.Wallpaper">
            <intent-filter>
                <action android:name="com.android.systemui.recents.TOGGLE_RECENTS" />
            </intent-filter>
        </activity>

        <activity android:name=".recents.tv.RecentsTvActivity"
                  android:label="@string/accessibility_desc_recent_apps"
                  android:exported="false"
                  android:launchMode="singleInstance"
                  android:excludeFromRecents="true"
                  android:stateNotNeeded="true"
                  android:resumeWhilePausing="true"
                  android:screenOrientation="behind"
                  android:theme="@style/RecentsTvTheme.Wallpaper">
            <intent-filter>
                <action android:name="com.android.systemui.recents.TOGGLE_RECENTS" />
            </intent-filter>
        </activity>

        <activity
            android:name=".stackdivider.ForcedResizableInfoActivity"
            android:theme="@style/ForcedResizableTheme"
            android:excludeFromRecents="true"
            android:stateNotNeeded="true"
            android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout"
            android:exported="false">
        </activity>

        <!-- Callback for dismissing screenshot notification after a share target is picked -->
        <receiver android:name=".screenshot.GlobalScreenshot$TargetChosenReceiver"
                  android:process=":screenshot"
                  android:exported="false" />

        <!-- Callback for deleting screenshot notification -->
        <receiver android:name=".screenshot.GlobalScreenshot$DeleteScreenshotReceiver"
                  android:process=":screenshot"
                  android:exported="false" />

        <!-- started from UsbDeviceSettingsManager -->
        <activity android:name=".usb.UsbConfirmActivity"
            android:exported="true"
            android:permission="android.permission.MANAGE_USB"
            android:theme="@style/Theme.SystemUI.Dialog.Alert"
            android:finishOnCloseSystemDialogs="true"
            android:excludeFromRecents="true">
        </activity>

        <!-- started from UsbDeviceSettingsManager -->
        <activity android:name=".usb.UsbPermissionActivity"
            android:exported="true"
            android:permission="android.permission.MANAGE_USB"
            android:theme="@style/Theme.SystemUI.Dialog.Alert"
            android:finishOnCloseSystemDialogs="true"
            android:excludeFromRecents="true">
        </activity>

        <!-- started from UsbDeviceSettingsManager -->
        <activity android:name=".usb.UsbResolverActivity"
            android:exported="true"
            android:permission="android.permission.MANAGE_USB"
            android:theme="@style/Theme.SystemUI.Dialog.Alert"
            android:finishOnCloseSystemDialogs="true"
            android:excludeFromRecents="true">
        </activity>

        <!-- started from UsbDeviceSettingsManager -->
        <activity android:name=".usb.UsbAccessoryUriActivity"
            android:exported="true"
            android:permission="android.permission.MANAGE_USB"
            android:theme="@style/Theme.SystemUI.Dialog.Alert"
            android:finishOnCloseSystemDialogs="true"
            android:excludeFromRecents="true">
        </activity>

        <!-- started from UsbDebuggingManager -->
        <activity android:name=".usb.UsbDebuggingActivity"
            android:permission="android.permission.MANAGE_USB"
            android:theme="@style/Theme.SystemUI.Dialog.Alert"
            android:finishOnCloseSystemDialogs="true"
            android:excludeFromRecents="true">
        </activity>
        <activity android:name=".usb.UsbDebuggingSecondaryUserActivity"
            android:theme="@style/Theme.SystemUI.Dialog.Alert"
            android:finishOnCloseSystemDialogs="true"
            android:excludeFromRecents="true">
        </activity>

        <!-- started from NetworkPolicyManagerService -->
        <activity
            android:name=".net.NetworkOverLimitActivity"
            android:exported="true"
            android:permission="android.permission.MANAGE_NETWORK_POLICY"
            android:theme="@android:style/Theme.DeviceDefault.Light.Panel"
            android:finishOnCloseSystemDialogs="true"
            android:launchMode="singleTop"
            android:taskAffinity="com.android.systemui.net"
            android:excludeFromRecents="true" />

        <!-- started from MediaProjectionManager -->
        <activity
            android:name=".media.MediaProjectionPermissionActivity"
            android:exported="true"
            android:theme="@style/Theme.AlertDialogHost"
            android:finishOnCloseSystemDialogs="true"
            android:launchMode="singleTop"
            android:excludeFromRecents="true" />

        <!-- started from PipUI -->
        <activity
            android:name="com.android.systemui.tv.pip.PipMenuActivity"
            android:exported="true"
            android:theme="@style/PipTheme"
            android:launchMode="singleTop"
            android:taskAffinity=""
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|locale|layoutDirection"
            android:resizeableActivity="true"
            android:supportsPictureInPicture="true"
            androidprv:alwaysFocusable="true"
            android:excludeFromRecents="true" />
        <activity
            android:name="com.android.systemui.tv.pip.PipOverlayActivity"
            android:exported="true"
            android:theme="@style/PipTheme"
            android:taskAffinity=""
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|locale|layoutDirection"
            android:resizeableActivity="true"
            android:supportsPictureInPicture="true"
            android:excludeFromRecents="true" />
        <activity
            android:name="com.android.systemui.tv.pip.PipOnboardingActivity"
            android:exported="true"
            android:theme="@style/PipTheme"
            android:launchMode="singleTop"
            android:excludeFromRecents="true" />

        <!-- platform logo easter egg activity -->
        <activity
            android:name=".DessertCase"
            android:exported="true"
            android:label="@string/dessert_case"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:hardwareAccelerated="true"
            android:launchMode="singleInstance"
            android:screenOrientation="locked"
            android:process=":sweetsweetdesserts"
            android:excludeFromRecents="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity android:name=".egg.MLandActivity"
                  android:theme="@android:style/Theme.Material.NoActionBar"
                  android:exported="true"
                  android:icon="@drawable/icon"
                  android:label="@string/mland"
                  android:hardwareAccelerated="true"
                  android:launchMode="singleInstance"
                  android:screenOrientation="locked"
                  android:process=":sweetsweetdesserts"
                  android:excludeFromRecents="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <!-- a gallery of delicious treats -->
        <service
            android:name=".DessertCaseDream"
            android:exported="true"
            android:label="@string/dessert_case"
            android:permission="android.permission.BIND_DREAM_SERVICE"
            android:enabled="false"
            android:process=":sweetsweetdesserts"
            >
            <intent-filter>
                <action android:name="android.service.dreams.DreamService" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </service>

        <service
            android:name=".keyguard.KeyguardService"
            android:exported="true"
            android:enabled="@bool/config_enableKeyguardService" />

        <activity android:name=".Somnambulator"
            android:label="@string/start_dreams"
            android:icon="@mipmap/ic_launcher_dreams"
            android:theme="@android:style/Theme.Wallpaper.NoTitleBar"
            android:exported="true"
            android:excludeFromRecents="true"
            >
            <!--
            <intent-filter>
                <action android:name="android.intent.action.CREATE_SHORTCUT" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            -->
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.DESK_DOCK" />
            </intent-filter>
        </activity>

        <activity
            android:name=".settings.BrightnessDialog"
            android:label="@string/quick_settings_brightness_dialog_title"
            android:theme="@android:style/Theme.DeviceDefault.Dialog"
            android:finishOnCloseSystemDialogs="true"
            android:launchMode="singleInstance"
            android:excludeFromRecents="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.SHOW_BRIGHTNESS_DIALOG" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <!-- Doze with notifications, run in main sysui process for every user  -->
        <service
            android:name=".doze.DozeService"
            android:exported="true"
            android:singleUser="true"
            android:permission="android.permission.BIND_DREAM_SERVICE" />

        <receiver
            android:name=".tuner.TunerService$ClearReceiver"
            android:exported="false">
            <intent-filter>
                <action android:name="com.android.systemui.action.CLEAR_TUNER" />
            </intent-filter>
        </receiver>

        <receiver
            android:name=".statusbar.KeyboardShortcutsReceiver">
            <intent-filter>
                <action android:name="android.intent.action.DISMISS_KEYBOARD_SHORTCUTS" />
                <action android:name="android.intent.action.SHOW_KEYBOARD_SHORTCUTS" />
            </intent-filter>
        </receiver>
    </application>
</manifest>
