Switch branches/tags
studio-3.1.2 studio-3.0 studio-2.3 gradle_3.1.2 gradle_3.0.0 gradle_2.3.0 android-wear-p-preview-2 android-wear-o-preview-4 android-wear-o-preview-3 android-wear-n-preview-2 android-wear-n-preview-1 android-wear-8.1.0_r1 android-wear-8.0.0_r1 android-wear-7.1.1_r1 android-wear-5.1.1_r1 android-wear-5.1.0_r1 android-wear-5.0.0_r1 android-vts-9.0_r4 android-vts-8.1_r6 android-vts-8.1_r5 android-vts-8.1_r4 android-vts-8.1_r3 android-vts-8.0_r9 android-vts-8.0_r8 android-vts-8.0_r7 android-vts-8.0_r6 android-vts-8.0_r2 android-vts-8.0_r1 android-sdk-support_r11 android-sdk-adt_r20 android-sdk-adt_r16.0.1 android-sdk-4.4.2_r1.0.1 android-sdk-4.4.2_r1 android-sdk-4.0.3_r1 android-sdk-4.0.3-tools_r1 android-p-preview-5 android-p-preview-4 android-p-preview-3 android-p-preview-2 android-p-preview-1 android-o-preview-4 android-o-preview-3 android-o-preview-2 android-o-preview-1 android-o-mr1-preview-2 android-o-mr1-preview-1 android-o-mr1-iot-release-smart-display-r3 android-o-mr1-iot-release-1.0.5 android-o-mr1-iot-release-1.0.4 android-o-mr1-iot-release-1.0.3 android-o-mr1-iot-release-1.0.2 android-o-mr1-iot-release-1.0.1 android-o-mr1-iot-release-1.0.0 android-o-mr1-iot-preview-8 android-o-mr1-iot-preview-7 android-o-mr1-iot-preview-6 android-o-iot-preview-5 android-n-preview-5 android-n-preview-4 android-n-preview-3 android-n-preview-2 android-n-preview-1 android-n-mr2-preview-2 android-n-mr2-preview-1 android-n-mr1-preview-2 android-n-mr1-preview-1 android-n-iot-release-smart-display android-n-iot-release-smart-display-r2 android-n-iot-release-polk-at1 android-n-iot-release-lg-thinq-wk7 android-n-iot-preview-4 android-n-iot-preview-2 android-m-preview android-m-preview-2 android-m-preview-1 android-l-preview_r2 android-cts-verifier-4.0.3_r1 android-cts-verifier-4.0_r1 android-cts-9.0_r4 android-cts-9.0_r3 android-cts-9.0_r2 android-cts-9.0_r1 android-cts-8.1_r11 android-cts-8.1_r10 android-cts-8.1_r9 android-cts-8.1_r8 android-cts-8.1_r7 android-cts-8.1_r6 android-cts-8.1_r5 android-cts-8.1_r4 android-cts-8.1_r3 android-cts-8.1_r2 android-cts-8.1_r1 android-cts-8.0_r15 android-cts-8.0_r14 android-cts-8.0_r13 android-cts-8.0_r12 android-cts-8.0_r11 android-cts-8.0_r10 android-cts-8.0_r9
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
docs
plugin
res-keyguard
res
scripts
shared
src/com/android
tests
Android.bp
AndroidManifest.xml
MODULE_LICENSE_APACHE2
NOTICE
OWNERS
README.md
lint.xml
proguard.flags

README.md

SystemUI

“Everything you see in Android that's not an app”

SystemUI is a persistent process that provides UI for the system but outside of the system_server process.

The starting point for most of sysui code is a list of services that extend SystemUI that are started up by SystemUIApplication. These services then depend on some custom dependency injection provided by Dependency.

Inputs directed at sysui (as opposed to general listeners) generally come in through IStatusBar. Outputs from sysui are through a variety of private APIs to the android platform all over.

SystemUIApplication

When SystemUIApplication starts up, it will start up the services listed in config_systemUIServiceComponents or config_systemUIServiceComponentsPerUser.

Each of these services extend SystemUI. SystemUI provides them with a Context and gives them callbacks for onConfigurationChanged (this historically was the main path for onConfigurationChanged, now also happens through ConfigurationController). They also receive a callback for onBootCompleted since these objects may be started before the device has finished booting.

SystemUI and SystemUIApplication also have methods for putComponent and getComponent which were existing systems to get a hold of other parts of sysui before Dependency existed. Generally new things should not be added to putComponent, instead Dependency and other refactoring is preferred to make sysui structure cleaner.

Each SystemUI service is expected to be a major part of system ui and the goal is to minimize communication between them. So in general they should be relatively silo'd.

Dependencies

The first SystemUI service that is started should always be Dependency. Dependency provides a static method for getting a hold of dependencies that have a lifecycle that spans sysui. Dependency has code for how to create all dependencies manually added. SystemUIFactory is also capable of adding/replacing these dependencies.

Dependencies are lazily initialized, so if a Dependency is never referenced at runtime, it will never be created.

If an instantiated dependency implements Dumpable it will be included in dumps of sysui (and bug reports), allowing it to include current state information. This is how *Controllers dump state to bug reports.

If an instantiated dependency implements ConfigurationChangeReceiver it will receive onConfigurationChange callbacks when the configuration changes.

IStatusBar

CommandQueue is the object that receives all of the incoming events from the system_server. It extends IStatusBar and dispatches those callbacks back any number of listeners. The system_server gets a hold of the IStatusBar when StatusBar calls IStatusBarService#registerStatusBar, so if StatusBar is not included in the XML service list, it will not be registered with the OS.

CommandQueue posts all incoming callbacks to a handler and then dispatches those messages to each callback that is currently registered. CommandQueue also tracks the current value of disable flags and will call #disable immediately for any callbacks added.

There are a few places where CommandQueue is used as a bus to communicate across sysui. Such as when StatusBar calls CommandQueue#recomputeDisableFlags. This is generally used a shortcut to directly trigger CommandQueue rather than calling StatusManager and waiting for the call to come back to IStatusBar.

Default SystemUI services list

com.android.systemui.Dependency

Provides custom dependency injection.

com.android.systemui.util.NotificationChannels

Creates/initializes the channels sysui uses when posting notifications.

com.android.systemui.statusbar.CommandQueue$CommandQueueStart

Creates CommandQueue and calls putComponent because its always been there and sysui expects it to be there :/

com.android.systemui.keyguard.KeyguardViewMediator

Manages keyguard view state.

com.android.systemui.recents.Recents

Recents tracks all the data needed for recents and starts/stops the recents activity. It provides this cached data to RecentsActivity when it is started.

com.android.systemui.volume.VolumeUI

Registers all the callbacks/listeners required to show the Volume dialog when it should be shown.

com.android.systemui.stackdivider.Divider

Shows the drag handle for the divider between two apps when in split screen mode.

com.android.systemui.SystemBars

This is a proxy to the actual SystemUI for the status bar. This loads from config_statusBarComponent which defaults to StatusBar. (maybe this should be removed and copy how config_systemUiVendorServiceComponent works)

com.android.systemui.status.phone.StatusBar

This shows the UI for the status bar and the notification shade it contains. It also contains a significant amount of other UI that interacts with these surfaces (keyguard, AOD, etc.). StatusBar also contains a notification listener to receive notification callbacks.

com.android.systemui.usb.StorageNotification

Tracks USB status and sends notifications for it.

com.android.systemui.power.PowerUI

Tracks power status and sends notifications for low battery/power saver.

com.android.systemui.media.RingtonePlayer

Plays ringtones.

com.android.systemui.keyboard.KeyboardUI

Shows UI for keyboard shortcuts (triggered by keyboard shortcut).

com.android.systemui.pip.PipUI

Shows the overlay controls when Pip is showing.

com.android.systemui.shortcut.ShortcutKeyDispatcher

Dispatches shortcut to System UI components.

@string/config_systemUIVendorServiceComponent

Component allowing the vendor/OEM to inject a custom component.

com.android.systemui.util.leak.GarbageMonitor$Service

Tracks large objects in sysui to see if there are leaks.

com.android.systemui.LatencyTester

Class that only runs on debuggable builds that listens to broadcasts that simulate actions in the system that are used for testing the latency.

com.android.systemui.globalactions.GlobalActionsComponent

Shows the global actions dialog (long-press power).

com.android.systemui.ScreenDecorations

Draws decorations about the screen in software (e.g. rounded corners, cutouts).

com.android.systemui.fingerprint.FingerprintDialogImpl

Fingerprint UI.