When SystemUI loads in Android Boot

有些话、适合烂在心里 提交于 2019-12-13 02:12:51

问题


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 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 com.android.systemui 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()) 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 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!