case LAUNCH_ACTIVITY: { final ActivityClientRecord r = (ActivityClientRecord) msg.obj; r.packageInfo = getPackageInfoNoCheck( r.activityInfo.applicationInfo, r.compatInfo); handleLaunchActivity(r, null, "LAUNCH_ACTIVITY");
private void handleLaunchActivity(ActivityClientRecord r, Intent customIntent, String reason) { Activity a = performLaunchActivity(r, customIntent); if (a != null) { r.createdConfig = new Configuration(mConfiguration); reportSizeConfigurations(r); Bundle oldState = r.state; handleResumeActivity(r.token, false, r.isForward, !r.activity.mFinished && !r.startsNotResumed, r.lastProcessedSeq, reason); }}
比较重要的两个方法 一个 performLaunchActivity(),另一个是handleResumeActivity()。
performLaunchActivity()中:
attach( ) // 创建window 其与Activity的显示相关
onCreate(); // setContentView( ) 解析xml中view 并与decorview产生关联
handleResumeActivity()中:
执行activity中的onResume方法,将WindowManager将DecorView添加到Window中
将decorview添加到ViewRootImpl中,并有decorview执行测量、布局、绘制等操作。