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.pswp.cn/news/278887.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/278887.shtml
英文地址,請注明出處:http://en.pswp.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…