packages/SystemUI/res-keyguard/layout/keyguard_host_view.xml
packages/SystemUI/res-keyguard/layout/keyguard_bouncer.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:clipChildren="false"
android:clipToPadding="false">
<include
layout="@layout/keyguard_host_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</FrameLayout>
com/android/keyguard/dagger/KeyguardBouncerModule.java
com/android/keyguard/dagger/KeyguardBouncerModule.java
static ViewGroup providesRootView(LayoutInflater layoutInflater) {
return (ViewGroup) layoutInflater.inflate(R.layout.keyguard_bouncer, null);
}
packages/SystemUI/res/layout/super_status_bar.xml
<com.android.systemui.statusbar.phone.StatusBarWindowView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:sysui="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<FrameLayout
android:id="@+id/status_bar_launch_animation_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- -->
<FrameLayout
android:id="@+id/status_bar_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/system_bar_background" />
</com.android.systemui.statusbar.phone.StatusBarWindowView>
status_bar_container部分如下
NotificationShadeWindowView 的加载
StatusBar.java
start--->createAndAddWindows
public void createAndAddWindows(@Nullable RegisterStatusBarResult result) {
makeStatusBarView(result); //1
//这里的mNotificationShadeWindowController 是NotificationShadeWindowControllerImpl的实力对象
mNotificationShadeWindowController.attach(); //2
mStatusBarWindowController.attach();
}
1,先执行makeStatusBarView-->inflateStatusBarWindow
private void inflateStatusBarWindow() {
mNotificationShadeWindowView = mSuperStatusBarViewFactory.getNotificationShadeWindowView();
//将加载的mNotificationShadeWindowView赋值给NotificationShadeWindowControllerImpl
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
}
public NotificationShadeWindowView getNotificationShadeWindowView() {
if (mNotificationShadeWindowView != null) {
return mNotificationShadeWindowView;
}
//加载布局
mNotificationShadeWindowView = (NotificationShadeWindowView)
mInjectionInflationController.injectable(
LayoutInflater.from(mContext)).inflate(R.layout.super_notification_shade,
/* root= */ null);
if (mNotificationShadeWindowView == null) {
throw new IllegalStateException(
"R.layout.super_notification_shade could not be properly inflated");
}
return mNotificationShadeWindowView;
}
2,执行完makeStatusBarView后在看createAndAddWindows中2处
mNotificationShadeWindowController.attach();
执行的是NotificationShadeWindowControllerImpl的attach方法
就是往mWindowManager中添加第1步中加载的super_notification_shade布局
即NotificationShadeWindowView
public void attach() {
mWindowManager.addView(mNotificationShadeView, mLp);
}
public void setNotificationShadeView(ViewGroup view) {
mNotificationShadeView = view;
}