SystemUI包含的的component
frameworks/base/packages/SystemUI/res/values/config.xml
<string-array name="config_systemUIServiceComponents" translatable="false">
<item>com.android.systemui.Dependency</item>
<item>com.android.systemui.util.NotificationChannels</item>
<item>com.android.systemui.statusbar.CommandQueue$CommandQueueStart</item>
<item>com.android.systemui.keyguard.KeyguardViewMediator</item>
<item>com.android.systemui.recents.Recents</item>
<item>com.android.systemui.volume.VolumeUI</item>
<item>com.android.systemui.stackdivider.Divider</item>
<item>com.android.systemui.SystemBars</item>
<item>com.android.systemui.usb.StorageNotification</item>
<item>com.android.systemui.power.PowerUI</item>
<item>com.android.systemui.media.RingtonePlayer</item>
<item>com.android.systemui.keyboard.KeyboardUI</item>
<item>com.android.systemui.pip.PipUI</item>
<item>com.android.systemui.shortcut.ShortcutKeyDispatcher</item>
<item>@string/config_systemUIVendorServiceComponent</item>
<item>com.android.systemui.util.leak.GarbageMonitor$Service</item>
<item>com.android.systemui.LatencyTester</item>
<item>com.android.systemui.globalactions.GlobalActionsComponent</item>
<item>com.android.systemui.ScreenDecorations</item>
<item>com.android.systemui.fingerprint.FingerprintDialogImpl</item>
<item>com.android.systemui.SliceBroadcastRelayHandler</item>
</string-array>
首先启动SystemUIService,在service中调用SystemUIApplication的方法使所有的component都run起来。
frameworks/base/packages/SystemUI/src/com/android/systemui/SystemUIService.java
frameworks/base/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
看一下这些component的功能
component | function |
---|---|
com.android.systemui.Dependency | 懒加载初始化一些对象,这些对象是伴随sysui的整个生命周期,可以被sysui的多个模块使用。简单理解,就是sysui的初始化 |
com.android.systemui.util.NotificationChannels | 通知的设置 |
com.android.systemui.statusbar.CommandQueue$CommandQueueStart | 执行Binder线程中IStatusBar的功能,推送消息到主线程 |
com.android.systemui.keyguard.KeyguardViewMediator | 调解对键盘锁的请求 |
com.android.systemui.recents.Recents | 最近的任务 |
com.android.systemui.volume.VolumeUI | 音量 |
com.android.systemui.stackdivider.Divider | 屏幕分割栏 |
com.android.systemui.SystemBars | 状态栏 |
com.android.systemui.usb.StorageNotification | usb连接状态 |
com.android.systemui.power.PowerUI | 电量 |
com.android.systemui.media.RingtonePlayer | 铃声播放器 |
com.android.systemui.keyboard.KeyboardUI | 键盘 |
com.android.systemui.pip.PipUI | 画中画窗口 |
com.android.systemui.shortcut.ShortcutKeyDispatcher | 分发快捷键事件 |
@string/config_systemUIVendorServiceComponent == com.android.systemui.VendorServices | 为某特定厂商占位的 |
com.android.systemui.util.leak.GarbageMonitor$Service | 垃圾监视 |
com.android.systemui.LatencyTester | 测试延迟 |
com.android.systemui.globalactions.GlobalActionsComponent | 长按电源键的菜单和关机 |
com.android.systemui.ScreenDecoration | 屏幕上的一层装饰 |
com.android.systemui.fingerprint.FingerprintDialogImpl | 指纹对话框 |
com.android.systemui.SliceBroadcastRelayHandler | Allows settings to register certain broadcasts to launch the settings app for pinned slices. |
读源码有感
既要继承IStatusBar.Stub,又要继承SystemUI,怎么实现?
定义2个class,其中一个定义成静态内部类,在静态内部类中创建另一个类的实例。