android 9.0新ui,SystemUI分析(Android9.0)

66b52468c121889b900d4956032f1009.png

8种机械键盘轴体对比

本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?

一、SystemUI组成

SystemUI是Android的系统界面,包括状态栏statusbar、锁屏keyboard、任务列表recents等等,都继承于SystemUI这个类,如锁屏KeyguardViewMediator。

1794ceb571258edea0355e492da21961.png

二、SystemUI启动流程

SystemUI的启动由SystemServer开始。SystemServer由Zygote fork生成的,进程名为system_server,该进程承载着framework的核心服务。Zygote启动过程中会调用startSystemServer()。SystemUI的分析从SystemServer的main方法开始。SystemUI启动的大致流程如下:

f5a44ef368bb4e860e8cea4ed54300c1.png

2.1 SystemServer

SystemServer在run方法中负责启动系统的各种服务。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15..........

// Start services.

try {

traceBeginAndSlog("StartServices");

startBootstrapServices();

startCoreServices();

startOtherServices();

SystemServerInitThreadPool.shutdown();

} catch (Throwable ex) {

Slog.e("System", "******************************************");

Slog.e("System", "************ Failure starting system services", ex);

throw ex;

} finally {

traceEnd();

}

在startOtherServices方法中先是创建并添加WindowManagerService、InputManagerService等service,并且调用startSystemUi方法,跳转SystemUIService。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25private void startOtherServices() {

//创建,注册服务

...

WindowManagerService wm = null;

SerialService serial = null;

NetworkTimeUpdateService networkTimeUpdater = null;

CommonTimeManagementService commonTimeMgmtService = null;

InputManagerService inputManager = null;

...

traceBeginAndSlog("IpConnectivityMetrics");

mSystemServiceManager.startService(IpConnectivityMetrics.class);

traceEnd();

traceBeginAndSlog("NetworkWatchlistService");

mSystemServiceManager.startService(NetworkWatchlistService.Lifecycle.class);

traceEnd();

...

traceBeginAndSlog("StartSystemUI");

try {

startSystemUi(context, windowManagerF);

} catch (Throwable e) {

reportWtf("starting System UI", e);

}

启动跳转SystemUIService。

1

2

3

4

5

6

7

8

9static final void startSystemUi(Context context, WindowManagerService windowManager) {

Intent intent = new Intent();

intent.setComponent(new ComponentName("com.android.systemui",

"com.android.systemui.SystemUIService"));

intent.addFlags(Intent.FLAG_DEBUG_TRIAGED_MISSING);

//Slog.d(TAG, "Starting service: " + intent);

context.startServiceAsUser(intent, UserHandle.SYSTEM);

windowManager.onSystemUiStarted();

}

2.2 SystemUIService

SystemUIService在onCreate中调用SystemUIApplication的startServicesIfNeeded方法。

1

2

3

4

5

6

7

8

9

10

11

12@Override

public void onCreate() {

super.onCreate();

((SystemUIApplication) getApplication()).startServicesIfNeeded();

// For debugging RescueParty

if (Build.IS_DEBUGGABLE && SystemProperties.getBoolean("debug.crash_sysui", false)) {

throw new RuntimeException();

}

...

}

2.3 SystemUIApplication

SystemUIApplication先获取配置的systemUI组件。

1

2

3

4public void startServicesIfNeeded() {

String[] names = getResources().getStringArray(R.array.config_systemUIServiceComponents);

startServicesIfNeeded(names);

}

配置文件在/frameworks/base/packages/SystemUI/res/values/config.xml中,配置的systemui组件如图:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

332 com.android.systemui.Dependency

333 com.android.systemui.util.NotificationChannels

334 com.android.systemui.statusbar.CommandQueue$CommandQueueStart

335 com.android.systemui.keyguard.KeyguardViewMediator

336 com.android.systemui.recents.Recents

337 com.android.systemui.volume.VolumeUI

338 com.android.systemui.stackdivider.Divider

339 com.android.systemui.SystemBars

340 com.android.systemui.usb.StorageNotification

341 com.android.systemui.power.PowerUI

342 com.android.systemui.media.RingtonePlayer

343 com.android.systemui.keyboard.KeyboardUI

344 com.android.systemui.pip.PipUI

345 com.android.systemui.shortcut.ShortcutKeyDispatcher

346 @string/config_systemUIVendorServiceComponent

347 com.android.systemui.util.leak.GarbageMonitor$Service

348 com.android.systemui.LatencyTester

349 com.android.systemui.globalactions.GlobalActionsComponent

350 com.android.systemui.ScreenDecorations

351 com.android.systemui.fingerprint.FingerprintDialogImpl

352 com.android.systemui.SliceBroadcastRelayHandler

353

在startServicesIfNeeded方法中,根据config配置创建SystemUI,并调用SystemUI的start方法。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31private void startServicesIfNeeded(String[] services) {

if (mServicesStarted) {

return;

}

mServices = new SystemUI[services.length];

final int N = services.length;

for (int i = 0; i < N; i++) {

String clsName = services[i];

if (DEBUG) Log.d(TAG, "loading: " + clsName);

log.traceBegin("StartServices" + clsName);

long ti = System.currentTimeMillis();

Class cls;

try {

cls = Class.forName(clsName);

mServices[i] = (SystemUI) cls.newInstance();

} catch(ClassNotFoundException ex){

throw new RuntimeException(ex);

} catch (IllegalAccessException ex) {

throw new RuntimeException(ex);

} catch (InstantiationException ex) {

throw new RuntimeException(ex);

}

mServices[i].mContext = this;

mServices[i].mComponents = mComponents;

if (DEBUG) Log.d(TAG, "running: " + mServices[i]);

mServices[i].start();

log.traceEnd();

...

}

2.4 SystemUI

SystemUI是一个抽象类,start()是抽象方法,具体实现在子类。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16public abstract class SystemUI implements SysUiServiceProvider {

public Context mContext;

public Map, Object> mComponents;

public abstract void start();

protected void onConfigurationChanged(Configuration newConfig) {

}

public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {

}

protected void onBootCompleted() {

}

...

}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/278887.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

WMI技术介绍和应用——WMI概述

https://blog.csdn.net/breaksoftware/article/details/8424317转载于:https://www.cnblogs.com/diyunpeng/p/9982885.html

解决App启动时白屏的问题

第一次 03-25 11:02:34.431 6908-6908/com.newenergyjinfu.jytz D/App: before_onCreate: 239 03-25 11:02:34.513 6908-6908/com.newenergyjinfu.jytz D/App: after_initOkGo( initPicasso): 316 03-25 11:02:34.570 6908-6908/com.newenergyjinfu.jytz D/App: after_ J…

chromebook刷机_如何为不支持Chrome操作系统的网站欺骗Chromebook用户代理

chromebook刷机Not all browsers handle websites the same, and if they don’t support your operating system or browser, you could be denied access. Luckily, you can spoof the user agent on Chrome OS to make it look like you use a completely different system.…

什么时候可以升级HarmonyOS,华为鸿蒙OS即将迎来升级 手机版本或仍需时间

原标题&#xff1a;华为鸿蒙OS即将迎来升级 手机版本或仍需时间在2019年的华为开发者大会上&#xff0c;华为消费者业务CEO余承东正式对外发布了HarmonyOS。时隔一年后&#xff0c;华为开发者大会2020即将拉开帷幕。此次大会&#xff0c;HarmonyOS无疑仍会是重头戏之一&#xf…

Shell_mysql命令以及将数据导入Mysql数据库

连接MYSQL数据库 mysql -h${db_ip} -u${db_user} -p${db_pawd} -P${db_port} -D${db_name} -s -e "${sql}" db_ip&#xff1a;主机地址 db_user &#xff1a;数据库用户名 db_pwd&#xff1a;密码 db_port&#xff1a;端口号 db_name&#xff1a;数据库名称 sql&…

cocos android-1,cocos2dx在windows下开发,编译到android上(1)

转自&#xff1a;http://www.2cto.com/kf/201205/130697.html下面我给大家介绍下&#xff0c;用vs2010开发cocos2dx&#xff0c;然后如何使其编译到android上。步骤如下&#xff1a;1、必要条件&#xff0c;你的eclipse能把代码编译到安卓手机或虚拟机上&#xff0c;如果这一步…

中药ppi网络图太杂乱_太杂乱了吗? 这是您的iPhone,iPad,Android或台式机的15张简约壁纸...

中药ppi网络图太杂乱Busy wallpaper images don’t work very well on your iPhone, iPad, or any device where you need to have lots of icons on the screen. Here’s a set of minimalistic wallpaper images that won’t clutter up your desktop. 繁忙的墙纸图像在iPhon…

算法61---两个字符串的最小ASCII删除和【动态规划】

一、题目&#xff1a; 给定两个字符串s1, s2&#xff0c;找到使两个字符串相等所需删除字符的ASCII值的最小和。 示例 1: 输入: s1 "sea", s2 "eat" 输出: 231 解释: 在 "sea" 中删除 "s" 并将 "s" 的值(115)加入总和。 在…

android设置时间widget,【Android】时间与日期Widget(DatePicker 与 TimePicker)

public class Activity01 extends Activity{TextViewm_TextView;//声明dataPickerDatePickerm_DatePicker;//声明TimePickerTimePickerm_TimePicker;Button m_dpButton;Button m_tpButton;//java中的Calendar类Calendar c;/** Called when the activity is first created. */Ov…

初学者java学习计划_初学者:计划在Windows 7 Media Center中录制直播电视的时间

初学者java学习计划If you’re a new user to Windows 7 Media Center you know it can act as a DVR and pause or record Live TV. You can set up a schedule for it to record your favorite TV programs as well. 如果您是Windows 7 Media Center的新用户&#xff0c;则知…

双数据源配置

从此抄录&#xff1a;https://blog.csdn.net/ll535299/article/details/78203634 1、先配置两个数据源&#xff0c;附上主要代码&#xff0c;给自己回忆&#xff0c;详解见开头链接 <!-- 配置数据源 --> <bean id"szDS" class"com.alibaba.druid.pool.…

如何在Office 2007中查看关于对话框和版本信息

One of our favorite readers wrote in today asking how to tell if his Word 2007 installation was running Service Pack 1, since he couldn’t find the About dialog, which got me thinking… I bet most people don’t know where it is! 我们最喜欢的一位读者今天写信…

windows全局热键_在Windows中创建快捷方式或热键以清除剪贴板

windows全局热键Have you ever copied something to the clipboard that you don’t want to leave there in case somebody else is going to use your computer? Sure, you can copy something else to the clipboard real quick, but can’t you just make a shortcut or h…

android+notepad教程,Android Sample学习——NotePad

android.view.Menu专场Interface for managing the items in a menu.By default, every Activity supports an options menu of actions or options. You can add items to this menu and handle clicks on your additions. The easiest way of adding menu items is inflating…

Windows应用程序开发

Windows窗体应用程序开发&#xff1a;WinForm、桌面应用程序&#xff0c;有可执行文件(.exe)即安装包。是一种C/S&#xff08;客户机/服务器&#xff09;架构应用程序 1.Windows窗体应用程序&#xff0c;用可视化的窗体和控件生成丰富界面的&#xff0c;可交互操作的应用程序。…

获取outlook 会议_如何仅在Microsoft Outlook中仅获取您关注的电子邮件的通知

获取outlook 会议Some emails are more important than others. Rather than getting alerts every time an email arrives, configure Microsoft Outlook to only alert you when the important stuff hits your inbox, rather than any old email that can wait until you ch…

jq html 多一个引号,为什么jQuery模板会为某些字符串添加双引号

背景我正在使用jQuery模板,ASP.Net MVC Razor视图和Twitter.问题使用带有一些字符串的jQuery模板会自动导致这些字符串被包含在“细节我创建了一个如下所示的jQuery模板&#xff1a;before ${text.parseUserName().parseHashTag()} after${created_at}${prettyDate(created_at)…

从Windows计算机上完全删除iTunes和其他Apple软件

If you are giving up on iTunes for another music player, uninstalling it completely can be a hassle. Here we show you how to completely remove all traces of it including QuickTime, iTunes Helper, Bonjour…all of it. 如果您在iTunes上放弃了其他音乐播放器&…

html仿微信滑动删除,使用Vue实现移动端左滑删除效果附源码

左滑删除在移动端是很常见的一种操作&#xff0c;常见于删除购物车中的商品&#xff0c;删除收藏夹中文章等等场景。我们只需要手指按住要删除的对象&#xff0c;然后轻轻向左滑动&#xff0c;便会出现删除按钮&#xff0c;然后点击删除按钮即可删除对象。点击下载源码今天我给…

推荐书本_

1. c#_设计模式 《设计模式&#xff1a;可复用面向对象软件的基础》GoF 《面向对象分析与设计》Grady Booch 《敏捷软件开发&#xff1a;原则、模式与实践》 Robert C.Martin 《重构&#xff1a;改善既有代码的设计》 Martin Fowler 《Refactoring to Patterns》Jshua Kerievsk…