当前位置: 首页 > news >正文

建设产品网站课程/市场调研问卷

建设产品网站课程,市场调研问卷,合肥市建设局,哪些网站可以找到兼职做报表的源码基于API26在上一篇中,讲到由ActivityThread启动activity了ActivityThread即我们平时提到的主线程,上一篇中AMS处理启动activity的task和record信息后通过binder跨进程到应用当前线程继续启动activity现在看ActivityThread的scheduleLaunchActivity()…

源码基于API26
在上一篇中,讲到由ActivityThread启动activity了
ActivityThread即我们平时提到的主线程,上一篇中AMS处理启动activity的task和record信息后通过binder跨进程到应用当前线程继续启动activity
现在看ActivityThread的scheduleLaunchActivity()

@Overridepublic final void scheduleLaunchActivity(Intent intent, IBinder token, int ident,ActivityInfo info, Configuration curConfig, Configuration overrideConfig,CompatibilityInfo compatInfo, String referrer, IVoiceInteractor voiceInteractor,int procState, Bundle state, PersistableBundle persistentState,List<ResultInfo> pendingResults, List<ReferrerIntent> pendingNewIntents,boolean notResumed, boolean isForward, ProfilerInfo profilerInfo) {//更新进程状态updateProcessState(procState, false);//创建ActivityClientRecord并赋值ActivityClientRecord r = new ActivityClientRecord();r.token = token;r.ident = ident;r.intent = intent;r.referrer = referrer;r.voiceInteractor = voiceInteractor;r.activityInfo = info;r.compatInfo = compatInfo;r.state = state;r.persistentState = persistentState;r.pendingResults = pendingResults;r.pendingIntents = pendingNewIntents;r.startsNotResumed = notResumed;r.isForward = isForward;r.profilerInfo = profilerInfo;r.overrideConfig = overrideConfig;updatePendingConfiguration(curConfig);//带着ActivityClientRecord由Handler启动ActivitysendMessage(H.LAUNCH_ACTIVITY, r);}复制代码

接着看Handler

 public void handleMessage(Message msg) {...switch (msg.what) {case LAUNCH_ACTIVITY: {Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "activityStart");//handler传递过来的ActivityClientRecordfinal ActivityClientRecord r = (ActivityClientRecord) msg.obj;//赋值LoadedApkr.packageInfo = getPackageInfoNoCheck(r.activityInfo.applicationInfo, r.compatInfo);//继续启动activityhandleLaunchActivity(r, null, "LAUNCH_ACTIVITY");Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);} break;复制代码

接着handleLaunchActivity()

private void handleLaunchActivity(ActivityClientRecord r, Intent customIntent, String reason) {//跳过后台执行gcunscheduleGcIdler();mSomeActivitiesChanged = true;if (r.profilerInfo != null) {mProfiler.setProfiler(r.profilerInfo);mProfiler.startProfiling();}// 确保执行最新的配置handleConfigurationChanged(null, null);if (localLOGV) Slog.v(TAG, "Handling launch of " + r);// 创建activity之前初始化WindowManagerGlobal,获取IWindowMangerWindowManagerGlobal.initialize();//启动activityActivity a = performLaunchActivity(r, customIntent);//activity不为nullif (a != null) {r.createdConfig = new Configuration(mConfiguration);reportSizeConfigurations(r);Bundle oldState = r.state;//恢复activityhandleResumeActivity(r.token, false, r.isForward,!r.activity.mFinished && !r.startsNotResumed, r.lastProcessedSeq, reason);if (!r.activity.mFinished && r.startsNotResumed) {performPauseActivityIfNeeded(r, reason);//pre-Honeycomb apps需要保存初始状态以便再次创建if (r.isPreHoneycomb()) {r.state = oldState;}}} else {//不管什么原因出错调用AMS销毁activitytry {ActivityManager.getService().finishActivity(r.token, Activity.RESULT_CANCELED, null,Activity.DONT_FINISH_TASK_WITH_ACTIVITY);} catch (RemoteException ex) {throw ex.rethrowFromSystemServer();}}
}复制代码

接着performLaunchActivity()

private Activity performLaunchActivity(ActivityClientRecord r, Intent customIntent) {//LoadedApk检验ActivityInfo aInfo = r.activityInfo;if (r.packageInfo == null) {r.packageInfo = getPackageInfo(aInfo.applicationInfo, r.compatInfo,Context.CONTEXT_INCLUDE_CODE);}//component检验ComponentName component = r.intent.getComponent();if (component == null) {component = r.intent.resolveActivity(mInitialApplication.getPackageManager());r.intent.setComponent(component);}//原activity不为空可新建componentif (r.activityInfo.targetActivity != null) {component = new ComponentName(r.activityInfo.packageName,r.activityInfo.targetActivity);}//创建contextImplContextImpl appContext = createBaseContextForActivity(r);Activity activity = null;try {java.lang.ClassLoader cl = appContext.getClassLoader();//通过Instrumentation创建activity实例activity = mInstrumentation.newActivity(cl, component.getClassName(), r.intent);StrictMode.incrementExpectedActivityCount(activity.getClass());r.intent.setExtrasClassLoader(cl);r.intent.prepareToEnterProcess();if (r.state != null) {r.state.setClassLoader(cl);}} catch (Exception e) {if (!mInstrumentation.onException(activity, e)) {throw new RuntimeException("Unable to instantiate activity " + component+ ": " + e.toString(), e);}}try {//创建我们亲爱的applicationApplication app = r.packageInfo.makeApplication(false, mInstrumentation);if (localLOGV) Slog.v(TAG, "Performing launch of " + r);if (localLOGV) Slog.v(TAG, r + ": app=" + app+ ", appName=" + app.getPackageName()+ ", pkg=" + r.packageInfo.getPackageName()+ ", comp=" + r.intent.getComponent().toShortString()+ ", dir=" + r.packageInfo.getAppDir());if (activity != null) {//加载labelCharSequence title = r.activityInfo.loadLabel(appContext.getPackageManager());Configuration config = new Configuration(mCompatConfiguration);if (r.overrideConfig != null) {config.updateFrom(r.overrideConfig);}if (DEBUG_CONFIGURATION) Slog.v(TAG, "Launching activity "+ r.activityInfo.name + " with config " + config);Window window = null;if (r.mPendingRemoveWindow != null && r.mPreserveWindow) {window = r.mPendingRemoveWindow;r.mPendingRemoveWindow = null;r.mPendingRemoveWindowManager = null;}//context表示为activityappContext.setOuterContext(activity);//准备好了吗我们的activity来了activity.attach(appContext, this, getInstrumentation(), r.token,r.ident, app, r.intent, r.activityInfo, title, r.parent,r.embeddedID, r.lastNonConfigurationInstances, config,r.referrer, r.voiceInteractor, window, r.configCallback);if (customIntent != null) {activity.mIntent = customIntent;}r.lastNonConfigurationInstances = null;checkAndBlockForNetworkAccess();activity.mStartedActivity = false;int theme = r.activityInfo.getThemeResource();//设置主题if (theme != 0) {activity.setTheme(theme);}activity.mCalled = false;//activity已启动执行onCreate()了if (r.isPersistable()) {mInstrumentation.callActivityOnCreate(activity, r.state, r.persistentState);} else {mInstrumentation.callActivityOnCreate(activity, r.state);}if (!activity.mCalled) {throw new SuperNotCalledException("Activity " + r.intent.getComponent().toShortString() +" did not call through to super.onCreate()");}r.activity = activity;r.stopped = true;//没有关闭就要执行onStart()了if (!r.activity.mFinished) {activity.performStart();r.stopped = false;}if (!r.activity.mFinished) {//执行onRestoreInstanceState()if (r.isPersistable()) {if (r.state != null || r.persistentState != null) {mInstrumentation.callActivityOnRestoreInstanceState(activity, r.state,r.persistentState);}} else if (r.state != null) {mInstrumentation.callActivityOnRestoreInstanceState(activity, r.state);}}//没有finish()执行onPostCreate()if (!r.activity.mFinished) {activity.mCalled = false;if (r.isPersistable()) {mInstrumentation.callActivityOnPostCreate(activity, r.state,r.persistentState);} else {mInstrumentation.callActivityOnPostCreate(activity, r.state);}if (!activity.mCalled) {throw new SuperNotCalledException("Activity " + r.intent.getComponent().toShortString() +" did not call through to super.onPostCreate()");}}}r.paused = true;mActivities.put(r.token, r);} catch (SuperNotCalledException e) {throw e;} catch (Exception e) {if (!mInstrumentation.onException(activity, e)) {throw new RuntimeException("Unable to start activity " + component+ ": " + e.toString(), e);}}return activity;
}复制代码

系不系上面这个方法有点长了,但是很显然是我们开发平时接触很近的方法了
再看看attach()

//主要是给我们activity赋一大堆值
final void attach(Context context, ActivityThread aThread,Instrumentation instr, IBinder token, int ident,Application application, Intent intent, ActivityInfo info,CharSequence title, Activity parent, String id,NonConfigurationInstances lastNonConfigurationInstances,Configuration config, String referrer, IVoiceInteractor voiceInteractor,Window window, ActivityConfigCallback activityConfigCallback) {attachBaseContext(context);mFragments.attachHost(null /*parent*/);//window创建并赋值mWindow = new PhoneWindow(this, window, activityConfigCallback);mWindow.setWindowControllerCallback(this);mWindow.setCallback(this);mWindow.setOnWindowDismissedCallback(this);mWindow.getLayoutInflater().setPrivateFactory(this);if (info.softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) {mWindow.setSoftInputMode(info.softInputMode);}if (info.uiOptions != 0) {mWindow.setUiOptions(info.uiOptions);}//看见没这就是uiThreadmUiThread = Thread.currentThread();//主线程为ActivityThreadmMainThread = aThread;//原来这货再这赋值的每一个activity都有这个监控类mInstrumentation = instr;mToken = token;mIdent = ident;mApplication = application;mIntent = intent;mReferrer = referrer;mComponent = intent.getComponent();mActivityInfo = info;mTitle = title;mParent = parent;mEmbeddedID = id;mLastNonConfigurationInstances = lastNonConfigurationInstances;if (voiceInteractor != null) {if (lastNonConfigurationInstances != null) {mVoiceInteractor = lastNonConfigurationInstances.voiceInteractor;} else {mVoiceInteractor = new VoiceInteractor(voiceInteractor, this, this,Looper.myLooper());}}mWindow.setWindowManager((WindowManager)context.getSystemService(Context.WINDOW_SERVICE),mToken, mComponent.flattenToString(),(info.flags & ActivityInfo.FLAG_HARDWARE_ACCELERATED) != 0);if (mParent != null) {mWindow.setContainer(mParent.getWindow());}mWindowManager = mWindow.getWindowManager();mCurrentConfig = config;mWindow.setColorMode(info.colorMode);
}复制代码

还要问我activity启动了没有吗,我说没有

scheduleLaunchActivity()、handleLaunchActivity()、performLaunchActivity()
将activity的相关信息淋漓尽致的展现,没事多看看,我还没专研细致的方法呢。

http://www.lbrq.cn/news/1348201.html

相关文章:

  • 石家庄网站建设公司哪家好/软文广告例子
  • 公众号做电影采集网站会被封/今日国际新闻大事件
  • 专门做茶叶会的音乐网站/摘抄一则新闻
  • 沧州网站建设公司翼马/朋友圈广告怎么投放
  • 成都有哪些网站建设的公司/长春百度网站快速排名
  • 南山网站建设哪家效益快/企业网站制作教程
  • 江苏个人备案网站内容/谷歌搜索引擎免费
  • 建设一下网站要求提供源码/网站搜索引擎优化技术
  • 楚雄市城乡建设局网站/十大收益最好的自媒体平台
  • 在线聊天网站怎么做/网站优化排名方法
  • 网页设计和ui设计有什么区别/滨州seo招聘
  • 传奇网站一般怎么做的/怎么给客户推广自己的产品
  • 网页设计与制作策划书/seo实战
  • 做那种类型的网站seo好/湖南专业seo推广
  • wordpress 文章导入/seo引擎优化方案
  • 厦门海沧建设局网站/关键词简谱
  • 淘货铺/seo网站优化公司
  • 找外国女朋友的网站建设/青岛网站推广关键词
  • 一般网站的优缺点/深圳搜索竞价账户托管
  • 那些因素会影响网站的排名位置/怎么查询最新网站
  • 长沙抖音代运营电话/成都网站改版优化
  • 榆林公司做网站/站长之家域名信息查询
  • 衡水公司建网站费用/网站制作400哪家好
  • 博创安泰网站建设/真正永久免费的建站系统有哪些
  • 淇县住房和城乡建设局网站/百度建立自己的网站
  • 做室内设计特别好的网站/百度销售平台怎样联系
  • 做网站价格多少钱/什么是整合营销概念
  • 网站做app有什么意义/哈尔滨优化网站公司
  • 网站建设制作收费/宁波seo网络推广咨询价格
  • 网站开发建设公司/汕头seo收费
  • node.js 学习笔记2 进程/线程、fs
  • 解决苍穹外卖项目中 MyBatis - Plus 版本冲突问题
  • jetson上使用opencv的gstreamer进行MIPI和USB摄像头的连接以及udp推流
  • 鸿蒙网络编程系列61-仓颉版基于TCP实现最简单的HTTP服务器
  • 时间轮算法
  • 前端实现Excel文件的在线预览效果