问题
How to know when the system UI loads in Android boot process?
Where exactly the status bar and navigation bar view draws?
As SystemUI is a privileged app so is it loading before the start of a launcher app (Home screen)?
I am not sure. Any suggestion is welcome.
回答1:
Below is a chain of briefly explained steps that hopefully shed some light on the sequence of "loading" the system UI components at boot time. I'll demonstrate it on Android 4.2, although the sequence is quite similar for the other versions.
- When
SystemServeris "done" with the core system services, including StatusBarManagerService *, it informs the 3rd party code that the system is ready and starts the system UI (line 870), or more precise, SystemUIService in thecom.android.systemuipackage **. SystemUIServiceis just anAndroidapplication component whose onCreate() method starts/initializes UI components and stores references to the components in themServices[]array of SystemUI type. The 1st element (mServices[0]) is either the status bar or system bar (status + nav bar).- BaseStatusBar, the implementation of the abstract
SystemUIclass, does some UI stuff (like adding views toWindowManageretc.). Additionally it declares a range of abstract UI-related methods (e.g. createAndAddWindows()) to be implemented by subclasses, e.g. PhoneStatusBar. - The status bar and navigation bar aren't composed of a single view. Such subclasses of
BaseStatusBarasPhoneStatusBar,TabletStatusBaretc. *** deal with multiple classes basically subclassed from View whose drawing (so does status bar's drawing) takes place in the onDraw() method. - Important note: on system boot the status bar (and software navigation bar) won't be visible until the launcher
Activity's (the one with android.intent.category.HOME)onResume()method returns (and bootanimation exits) despite the fact all the views the status bar is composed of have already been laid out.
AOSP:
* frameworks/base/services/java/com/android/server/
** frameworks/base/packages/SystemUI/src/com/android/systemui/SystemUIService.java
*** frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/
回答2:
SystemUI is one of the first apps which starts. Because everything like the Lockscreen, Notifications, the Statusbar or the recent apps view are part of SystemUI. So yeah the SystemUI starts before your launcher is started
来源:https://stackoverflow.com/questions/37465026/when-systemui-loads-in-android-boot