Android--startActivityLocked
来源:互联网 发布:淘宝怎么防举报防排查 编辑:程序博客网 时间:2024/06/07 02:35
startActivityLocked(ActivityRecord r, boolean newTask,boolean doResume, boolean keepCurTransition, Bundle options)
传入的参数为:
ActivityRecord r:要启动的Activity的ActiviryRecord
boolean newTask:是否在一个新的Task中启动
boolean doResume:是否立刻启动
boolean keepCurTransition
Bundle options:一般为NULL,否则就是调用者传进来的
if (!newTask) { // If starting in an existing task, find where that is... boolean startIt = true; for (int i = NH-1; i >= 0; i--) { ActivityRecord p = mHistory.get(i); if (p.finishing) { continue; } if (p.task == r.task) { // Here it is! Now, if this is not yet visible to the // user, then just add it without starting; it will // get started when the user navigates back to it. addPos = i+1; if (!startIt) { if (DEBUG_ADD_REMOVE) { RuntimeException here = new RuntimeException("here"); here.fillInStackTrace(); Slog.i(TAG, "Adding activity " + r + " to stack at " + addPos, here); } mHistory.add(addPos, r); r.putInHistory(); mService.mWindowManager.addAppToken(addPos, r.appToken, r.task.taskId, r.info.screenOrientation, r.fullscreen); if (VALIDATE_TOKENS) { validateAppTokensLocked(); } ActivityOptions.abort(options); return; } break; } if (p.fullscreen) { startIt = false; } } }
首先判断是否要新建一个Task,通过newTask标志位来判断,如果为false ,代表不需要创建新的Task,然后遍历mHistory:
1.如果ActivityRecord.finishing说明该Activity正在finish中,那么跳过
2.判断ActivityRecord的TaskId与要启动的Activity的Task是否相同,
0 0
- Android--startActivityLocked
- Android源码--startActivityLocked
- ActivityStack类startActivityLocked方法解析
- Android
- android
- Android
- android
- android
- Android
- Android
- android
- android
- android
- Android
- Android
- android!!!
- android
- android
- New start
- 关于软中断原理,以及中断栈的概念等
- 有关C++模板(template)的编译错误“error LNK2019: 无法解析的外部符号”的分析
- mysqldump和source使用
- Evaluate Reverse Polish Notation【leetcode 2】
- Android--startActivityLocked
- svn提交静态库文件
- 第十八天-Java_IO
- hdu 5007 Post Robot(水题)
- jquery 图片旋转 rotate
- ThreadPoolExecutor使用和思考(上)-线程池大小设置与BlockingQueue的三种实现区别
- github 分支管理
- HDU1044 Collect More Jewels
- hdu4998 旋转坐标系