Subrat Subrat - 1 year ago 121
Android Question

When SystemUI loads in Android Boot

How to know when the system UI loads in

boot process?
Where exactly the status bar and navigation bar view draws?
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.

Answer Source

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 SystemServer is "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 the package **.
  • SystemUIService is just an Android application component whose onCreate() method starts/initializes UI components and stores references to the components in the mServices[] 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 SystemUI class, does some UI stuff (like adding views to WindowManager etc.). Additionally it declares a range of abstract UI-related methods (e.g. createAndAddWindows(): lines 127 - 133) to be implemented by subclasses, e.g. PhoneStatusBar.
  • The status bar and navigation bar aren't composed of a single view. Such subclasses of BaseStatusBar as PhoneStatusBar, TabletStatusBar etc. *** 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 drawn.

* frameworks/base/services/java/com/android/server/
** frameworks/base/packages/SystemUI/src/com/android/systemui/
*** frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download