当SystemUI在Android Boot中加载时 [英] When SystemUI loads in Android Boot

查看:243
本文介绍了当SystemUI在Android Boot中加载时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何知道何时在 Android 引导过程中加载系统UI?
状态栏和导航栏视图在哪里绘制?
由于 SystemUI 是特权应用程序,因此它是否在启动应用程序(主屏幕)启动之前加载?
我不确定。欢迎提出任何建议。

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.

推荐答案

下面是一连串简短说明的步骤,希望可以阐明一些步骤。在引导时加载系统UI组件。我将在 Android 4.2上进行演示,尽管其他版本的序列非常相似。

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.


  • SystemServer 与核心系统服务完成时,包括 StatusBarManagerService *,它通知第三方代码系统已准备就绪并启动系统用户界面(第870行)或更准确地说, com.android.systemui 中的 SystemUIService 包**。

  • SystemUIService 只是一个 Android 应用程序组件,其 onCreate() 方法启动/初始化UI组件并将对组件的引用存储在mServices [] 数组中/java/ext/com.google.android/android/4.2.1_r1.2/com/android/systemui/SystemUI.java#25 rel = noreferrer> SystemUI 类型。第一个元素( mServices [0] )是状态栏或系统栏(状态+导航栏)。

  • BaseStatusBar ,是抽象 SystemUI 类的实现,它可以执行一些UI内容(例如将视图添加到 WindowManager 等)。另外,它声明了一系列与UI相关的抽象方法(例如 createAndAddWindows() )由子类实现,例如 PhoneStatusBar

  • 状态栏和导航栏不是由单个视图组成。 BaseStatusBar 这样的子类,例如 PhoneStatusBar TabletStatusBar 等。* **处理基本上从 View 的图形(状态栏的图形也是如此)发生在 onDraw() 方法。

  • 重要说明: 在系统启动时,状态栏(和软件导航栏)直到启动器 Activity (带有 android.intent.category.HOME onResume()方法返回(并且退出动画退出),尽管状态栏所组成的所有视图均已布局。

  • 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 /服务/ java / com / android / server /

** frameworks / base / packages / SystemUI / src / com / android / systemui / SystemUIService.java < br> *** frameworks / base / packages / SystemUI / src / com / android / systemui / statusbar /

这篇关于当SystemUI在Android Boot中加载时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆