• Home
Name Date Size #Lines LOC

..--

animation/03-May-2024-9,1045,459

checks/03-May-2024-3,7062,935

compose/03-May-2024-5,2033,599

customization/03-May-2024-2,7231,820

docs/03-May-2024-2,9002,142

monet/03-May-2024-645460

plugin/03-May-2024-5,0242,412

plugin_core/03-May-2024-486148

res/03-May-2024-181,432146,269

res-keyguard/03-May-2024-16,00512,262

res-product/03-May-2024-4,5672,889

screenshot/03-May-2024-889542

scripts/03-May-2024-4,9214,592

shared/03-May-2024-12,8738,462

src/com/android/03-May-2024-443,161311,054

src-debug/com/android/systemui/03-May-2024-172104

src-release/com/android/systemui/03-May-2024-15890

tests/03-May-2024-260,950194,259

tools/lint/03-May-2024-89,98288,992

unfold/03-May-2024-2,5501,486

Android.bpD03-May-202414.6 KiB465428

AndroidManifest.xmlD03-May-202448.1 KiB1,016742

CleanSpec.mkD03-May-20242.4 KiB512

MODULE_LICENSE_APACHE2D03-May-20240

NOTICED03-May-202410.4 KiB191158

OWNERSD03-May-20241.9 KiB105100

README.mdD03-May-20247 KiB171113

TEST_MAPPINGD03-May-20244.6 KiB184182

ktfmt_includes.txtD03-May-202466.2 KiB754753

lint.xmlD03-May-2024106 44

proguard.flagsD03-May-20246.8 KiB145127

README.md

1# SystemUI
2
3“Everything you see in Android that's not an app”
4
5SystemUI is a persistent process that provides UI for the system but outside
6of the system_server process.
7
8Inputs directed at sysui (as opposed to general listeners) generally come in
9through IStatusBar. Outputs from sysui are through a variety of private APIs to
10the android platform all over.
11
12## SystemUIApplication
13
14When SystemUIApplication starts up, it instantiates a Dagger graph from which
15various pieces of the application are built.
16
17To support customization, SystemUIApplication relies on the AndroidManifest.xml
18having an `android.app.AppComponentFactory` specified. Specifically, it relies
19on an `AppComponentFactory` that subclases `SystemUIAppComponentFactoryBase`.
20Implementations of this abstract base class must override
21`#createSystemUIInitializer(Context)` which returns a `SystemUIInitializer`.
22`SystemUIInitializer` primary job in turn is to intialize and return the Dagger
23root component back to the `SystemUIApplication`.
24
25Writing a custom `SystemUIAppComponentFactoryBase` and `SystemUIInitializer`,
26should be enough for most implementations to stand up a customized Dagger
27graph, and launch a custom version of SystemUI.
28
29## Dagger / Dependency Injection
30
31See [dagger.md](docs/dagger.md) and https://dagger.dev/.
32
33## CoreStartable
34
35The starting point for most of SystemUI code is a list of classes that
36implement `CoreStartable` that are started up by SystemUIApplication.
37CoreStartables are like miniature services. They have their `#start` method
38called after being instantiated, and a reference to them is stored inside
39SystemUIApplication. They are in charge of their own behavior beyond this,
40registering and unregistering with the rest of the system as needed.
41
42`CoreStartable` also receives a callback for `#onBootCompleted`
43since these objects may be started before the device has finished booting.
44
45`CoreStartable` is an ideal place to add new features and functionality
46that does not belong directly under the umbrella of an existing feature.
47It is better to define a new `CoreStartable` than to stick unrelated
48initialization code together in catch-all methods.
49
50CoreStartables are tied to application startup via Dagger:
51
52```kotlin
53class FeatureStartable
54@Inject
55constructor(
56    /* ... */
57) : CoreStartable {
58    override fun start() {
59        // ...
60    }
61}
62
63@Module
64abstract class FeatureModule {
65    @Binds
66    @IntoMap
67    @ClassKey(FeatureStartable::class)
68    abstract fun bind(impl: FeatureStartable): CoreStartable
69}
70```
71
72Including `FeatureModule` in the Dagger graph such as this will ensure that
73`FeatureStartable` gets constructed and that its `#start` method is called.
74
75## IStatusBar
76
77CommandQueue is the object that receives all of the incoming events from the
78system_server. It extends IStatusBar and dispatches those callbacks back any
79number of listeners. The system_server gets a hold of the IStatusBar when
80StatusBar calls IStatusBarService#registerStatusBar, so if StatusBar is not
81included in the XML service list, it will not be registered with the OS.
82
83CommandQueue posts all incoming callbacks to a handler and then dispatches
84those messages to each callback that is currently registered. CommandQueue
85also tracks the current value of disable flags and will call #disable
86immediately for any callbacks added.
87
88There are a few places where CommandQueue is used as a bus to communicate
89across sysui. Such as when StatusBar calls CommandQueue#recomputeDisableFlags.
90This is generally used a shortcut to directly trigger CommandQueue rather than
91calling StatusManager and waiting for the call to come back to IStatusBar.
92
93### [com.android.systemui.util.NotificationChannels](/packages/SystemUI/src/com/android/systemui/util/NotificationChannels.java)
94
95Creates/initializes the channels sysui uses when posting notifications.
96
97### [com.android.systemui.keyguard.KeyguardViewMediator](/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java)
98
99Manages keyguard view state.
100
101### [com.android.systemui.recents.Recents](/packages/SystemUI/src/com/android/systemui/recents/Recents.java)
102
103Recents tracks all the data needed for recents and starts/stops the recents
104activity. It provides this cached data to RecentsActivity when it is started.
105
106### [com.android.systemui.volume.VolumeUI](/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java)
107
108Registers all the callbacks/listeners required to show the Volume dialog when
109it should be shown.
110
111### [com.android.systemui.status.phone.CentralSurfaces](/packages/SystemUI/src/com/android/systemui/status/phone/CentralSurfaces.java)
112
113This shows the UI for the status bar and the notification shade it contains.
114It also contains a significant amount of other UI that interacts with these
115surfaces (keyguard, AOD, etc.). CentralSurfaces also contains a notification listener
116to receive notification callbacks.
117
118### [com.android.systemui.usb.StorageNotification](/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java)
119
120Tracks USB status and sends notifications for it.
121
122### [com.android.systemui.power.PowerUI](/packages/SystemUI/src/com/android/systemui/power/PowerUI.java)
123
124Tracks power status and sends notifications for low battery/power saver.
125
126### [com.android.systemui.media.RingtonePlayer](/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java)
127
128Plays ringtones.
129
130### [com.android.systemui.keyboard.KeyboardUI](/packages/SystemUI/src/com/android/systemui/keyboard/KeyboardUI.java)
131
132Shows UI for keyboard shortcuts (triggered by keyboard shortcut).
133
134### [com.android.systemui.shortcut.ShortcutKeyDispatcher](/packages/SystemUI/src/com/android/systemui/shortcut/ShortcutKeyDispatcher.java)
135
136Dispatches shortcut to System UI components.
137
138### @string/config_systemUIVendorServiceComponent
139
140Component allowing the vendor/OEM to inject a custom component.
141
142### [com.android.systemui.util.leak.GarbageMonitor$Service](/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java)
143
144Tracks large objects in sysui to see if there are leaks.
145
146### [com.android.systemui.LatencyTester](/packages/SystemUI/src/com/android/systemui/LatencyTester.java)
147
148Class that only runs on debuggable builds that listens to broadcasts that
149simulate actions in the system that are used for testing the latency.
150
151### [com.android.systemui.globalactions.GlobalActionsComponent](/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsComponent.java)
152
153Shows the global actions dialog (long-press power).
154
155### [com.android.systemui.ScreenDecorations](/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java)
156
157Draws decorations about the screen in software (e.g. rounded corners, cutouts).
158
159### [com.android.systemui.biometrics.BiometricDialogImpl](/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java)
160
161Biometric UI.
162
163### [com.android.systemui.wmshell.WMShell](/packages/SystemUI/src/com/android/systemui/wmshell/WMShell.java)
164
165Delegates SysUI events to WM Shell controllers.
166
167---
168
169 * [Plugins](/packages/SystemUI/docs/plugins.md)
170 * [Demo Mode](/packages/SystemUI/docs/demo_mode.md)
171