两种类型:STARTING_WINDOW_TYPE_SNAPSHOT(任务快照-截屏-用于热起)、STARTING_WINDOW_TYPE_SPLASH_SCREEN(冷起)
启动一个activty
frameworks\base\core\java\android\app\Instrumentation.java#execStartActivity
frameworks\base\services\core\java\com\android\server\wm\ActivityTaskManagerService.java#startActivity
初始化 ActivityStarter ,并且执行启动
frameworks\base\services\core\java\com\android\server\wm\ActivityStarter.java#execute
frameworks\base\services\core\java\com\android\server\wm\ActivityStarter.java#executeRequest
frameworks\base\services\core\java\com\android\server\wm\ActivityStarter.java#startActivityUnchecked
frameworks\base\services\core\java\com\android\server\wm\ActivityStarter.java#startActivityInner
frameworks\base\services\core\java\com\android\server\wm\Task.java#resumeTopActivityInnerLocked
显示StartingWindow
frameworks\base\services\core\java\com\android\server\wm\ActivityRecord.java#showStartingWindow
frameworks\base\services\core\java\com\android\server\wm\ActivityRecord.java#addStartingWindow
frameworks\base\services\core\java\com\android\server\wm\ActivityRecord.java#scheduleAddStartingWindow
frameworks\base\services\core\java\com\android\server\wm\StartingSurfaceController.java#createSplashScreenStartingSurface
frameworks\base\services\core\java\com\android\server\wm\StartingSurfaceController.java#createTaskSnapshotSurface
frameworks\base\services\core\java\com\android\server\wm\TaskOrganizerController.java#addStartingWindow
在WMShell中添加StartingWindow
frameworks\base\libs\WindowManager\Shell\src\com\android\wm\shell\ShellTaskOrganizer.java#addStartingWindow
根据不同的type添加对应的StartingWindow,如果是Snapshot类型的StartingWindow会在主动调用WMS的addwindow和relayout方法,而SplashScreen类型的会走ViewRootImpl的流程
frameworks\base\libs\WindowManager\Shell\src\com\android\wm\shell\startingsurface\StartingWindowController.java#addStartingWindow
frameworks\base\libs\WindowManager\Shell\src\com\android\wm\shell\startingsurface\StartingSurfaceDrawer.java#addSplashScreenStartingWindow
Window第一帧绘制完毕
frameworks\base\services\core\java\com\android\server\wm\WindowManagerService.java#finishDrawingWindow
更新 mDrawState改成COMMIT_DRAW_PENDING
frameworks\base\services\core\java\com\android\server\wm\WindowStateAnimator.java#finishDrawingLocked
遍历Window
frameworks\base\services\core\java\com\android\server\wm\DisplayContent.java#mApplySurfaceChangesTransaction
更新mDrawState状态为READY_TO_SHOW
frameworks\base\services\core\java\com\android\server\wm\WindowStateAnimator.java#commitFinishDrawingLocked
针对于不同类型的window处理的方式不一样。如果是StartingWindow就会显示StartingWindow
frameworks\base\services\core\java\com\android\server\wm\WindowState.java#performShowLocked
if (mAttrs.type != TYPE_APPLICATION_STARTING) {
mActivityRecord.onFirstWindowDrawn(this, mWinAnimator);
} else {
mActivityRecord.onStartingWindowDrawn();
}
当是App第一帧绘制完毕时,会移除StartingWindow
frameworks\base\services\core\java\com\android\server\wm\ActivityRecord.java#onFirstWindowDrawn
frameworks\base\services\core\java\com\android\server\wm\ActivityRecord.java#removeStartingWindow
frameworks\base\services\core\java\com\android\server\wm\StartingSurfaceController$ShellStartingSurface.java#remove
frameworks\base\services\core\java\com\android\server\wm\TaskOrganizerController.java#removeStartingWindow
frameworks\base\services\core\java\com\android\server\wm\TaskOrganizerController$TaskOrganizerCallbacks.java#removeStartingWindow
调用WMShell来移除Window
frameworks\base\libs\WindowManager\Shell\src\com\android\wm\shell\ShellTaskOrganizer.java#removeStartingWindow
frameworks\base\libs\WindowManager\Shell\src\com\android\wm\shell\startingsurface\StartingSurfaceDrawer.java#removeStartingWindow
frameworks\base\libs\WindowManager\Shell\src\com\android\wm\shell\startingsurface\StartingSurfaceDrawer.java#removeWindowInner
frameworks\base\services\core\java\com\android\server\wm\WindowManagerService.java#removeWindow