如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
Android应用程序启动过程源代码分析(4)这个函数定义在frameworks/base/services/java/com/android/server/am/ActivityStack.java文件中:publicclassActivityStack{......finalbooleanrealStartActivityLocked(ActivityRecordr,ProcessRecordapp,booleanandResume,booleancheckConfig)throwsRemoteException{......r.app=app;......intidx=app.activities.indexOf(r);if(idx<0){app.activities.add(r);}......try{......List<ResultInfo>results=null;List<Intent>newIntents=null;if(andResume){results=r.results;newIntents=r.newIntents;}......app.thread.scheduleLaunchActivity(newIntent(r.intent),r,System.identityHashCode(r),r.info,r.icicle,results,newIntents,!andResume,mService.isNextTransitionForward());......}catch(RemoteExceptione){......}......returntrue;}......}这里最终通过app.thread进入到ApplicationThreadProxy的scheduleLaunchActivity函数中,注意,这里的第二个参数r,是一个ActivityRecord类型的Binder对象,用来作来这个Activity的token值。Step29.ApplicationThreadProxy.scheduleLaunchActivity这个函数定义在frameworks/base/core/java/android/app/ApplicationThreadNative.java文件中:classApplicationThreadProxyimplementsIApplicationThread{......publicfinalvoidscheduleLaunchActivity(Intentintent,IBindertoken,intident,ActivityInfoinfo,Bundlestate,List<ResultInfo>pendingResults,List<Intent>pendingNewIntents,booleannotResumed,booleanisForward)throwsRemoteException{Parceldata=Parcel.obtain();data.writeInterfaceToken(IApplicationThread.descriptor);intent.writeToParcel(data,0);data.writeStrongBinder(token);data.writeInt(ident);info.writeToParcel(data,0);data.writeBundle(state);data.writeTypedList(pendingResults);data.writeTypedList(pendingNewIntents);data.writeInt(notResumed?1:0);data.writeInt(isForward?1:0);mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION,data,null,IBinder.FLAG_ONEWAY);data.recycle();}......}这个函数最终通过Binder驱动程序进入到ApplicationThread的scheduleLaunchActivity函数中。Step30.ApplicationThread.scheduleLaunchActivity这个函数定义在frameworks/base/core/java/android/app/ActivityThread.java文件中:publicfi