代码路径:
frameworks/base/packages/SystemUI/res/layout/system_icons.xml
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
frameworks/base/packages/SystemUI/res/layout/status_bar_mobile_signal_group.xml
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarWifiView.java
frameworks/base/packages/SystemUI/res/layout/status_bar_wifi_group.xml
在system_icons.xml文件中,BatteryMeterView 主要是处理电量UI显示,StatusIconContainer 主要是处理wifi和4GUI显示
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
在CollapsedStatusBarFragment.java文件中onViewCreated方法中statusIcons就是添加添加状态栏wifi图标和4G图标
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mStatusBar = (PhoneStatusBarView) view;
if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_PANEL_STATE)) {
mStatusBar.restoreHierarchyState(
savedInstanceState.getSparseParcelableArray(EXTRA_PANEL_STATE));
}
//start 这里就是添加状态栏wifi图标和4G图标
mDarkIconManager = new DarkIconManager(view.findViewById(R.id.statusIcons));
mDarkIconManager.setShouldLog(true);
Dependency.get(StatusBarIconController.class).addIconGroup(mDarkIconManager);
//end
mSystemIconArea = mStatusBar.findViewById(R.id.system_icon_area);
mClockView = mStatusBar.findViewById(R.id.clock);
showSystemIconArea(false);
showClock(false);
initEmergencyCryptk