本文出自 “阿敏其人” 简书博客,转载或引用请注明出处。
这是Android-Activity所应该了解的大概就这样。(中)情景3里面的log记录。
如果有兴趣看,下面这部分摘取的情况3完整的log记录步骤。
==== 打开app1
Recent tasks:
* Recent #0: TaskRecord{52997fe8 #90 A=com.amqr.taskaffinity1 U=0 sz=1}
* Recent #1: TaskRecord{5295e6f8 #1 A=com.android.launcher U=0 sz=1}
* Recent #2: TaskRecord{52ac09c4 #89 A=com.android.systemui U=0 sz=0}
Running activities (most recent first):
TaskRecord{52997fe8 #90 A=com.amqr.taskaffinity1 U=0 sz=1}
Run #0: ActivityRecord{52947afc u0 com.amqr.taskaffinity1/.MainActivity1 t90}
===== 打开app1的other页面
Recent tasks:
* Recent #0: TaskRecord{52a8eab0 #91 A=com.amqr.independent U=0 sz=1}
* Recent #1: TaskRecord{52997fe8 #90 A=com.amqr.taskaffinity1 U=0 sz=1}
* Recent #2: TaskRecord{5295e6f8 #1 A=com.android.launcher U=0 sz=1}
* Recent #3: TaskRecord{52ac09c4 #89 A=com.android.systemui U=0 sz=0}
Running activities (most recent first):
TaskRecord{52a8eab0 #91 A=com.amqr.independent U=0 sz=1}
Run #1: ActivityRecord{529208ac u0 com.amqr.taskaffinity1/.App1Other t91}
TaskRecord{52997fe8 #90 A=com.amqr.taskaffinity1 U=0 sz=1}
Run #0: ActivityRecord{52947afc u0 com.amqr.taskaffinity1/.MainActivity1 t90}
==== 按下home
Recent tasks:
* Recent #0: TaskRecord{5295e6f8 #1 A=com.android.launcher U=0 sz=1}
* Recent #1: TaskRecord{52a8eab0 #91 A=com.amqr.independent U=0 sz=1}
* Recent #2: TaskRecord{52997fe8 #90 A=com.amqr.taskaffinity1 U=0 sz=1}
* Recent #3: TaskRecord{52ac09c4 #89 A=com.android.systemui U=0 sz=0}
Running activities (most recent first):
TaskRecord{52a8eab0 #91 A=com.amqr.independent U=0 sz=1}
Run #1: ActivityRecord{529208ac u0 com.amqr.taskaffinity1/.App1Other t91}
TaskRecord{52997fe8 #90 A=com.amqr.taskaffinity1 U=0 sz=1}
Run #0: ActivityRecord{52947afc u0 com.amqr.taskaffinity1/.MainActivity1 t90}
===== 打开 app2
Recent tasks:
* Recent #0: TaskRecord{52ac226c #92 A=com.amqr.taskaffinity2 U=0 sz=1}
* Recent #1: TaskRecord{5295e6f8 #1 A=com.android.launcher U=0 sz=1}
* Recent #2: TaskRecord{52a8eab0 #91 A=com.amqr.independent U=0 sz=1}
* Recent #3: TaskRecord{52997fe8 #90 A=com.amqr.taskaffinity1 U=0 sz=1}
* Recent #4: TaskRecord{52ac09c4 #89 A=com.android.systemui U=0 sz=0}
Running activities (most recent first):
TaskRecord{52ac226c #92 A=com.amqr.taskaffinity2 U=0 sz=1}
Run #2: ActivityRecord{52aba490 u0 com.amqr.taskaffinity2/.MainActivity2 t92}
TaskRecord{52a8eab0 #91 A=com.amqr.independent U=0 sz=1}
Run #1: ActivityRecord{529208ac u0 com.amqr.taskaffinity1/.App1Other t91}
TaskRecord{52997fe8 #90 A=com.amqr.taskaffinity1 U=0 sz=1}
Run #0: ActivityRecord{52947afc u0 com.amqr.taskaffinity1/.MainActivity1 t90}
====== 打开app2的other页面
Recent tasks:
* Recent #0: TaskRecord{52a8eab0 #91 A=com.amqr.independent U=0 sz=2}
* Recent #1: TaskRecord{52ac226c #92 A=com.amqr.taskaffinity2 U=0 sz=1}
* Recent #2: TaskRecord{5295e6f8 #1 A=com.android.launcher U=0 sz=1}
* Recent #3: TaskRecord{52997fe8 #90 A=com.amqr.taskaffinity1 U=0 sz=1}
* Recent #4: TaskRecord{52ac09c4 #89 A=com.android.systemui U=0 sz=0}
Running activities (most recent first):
TaskRecord{52a8eab0 #91 A=com.amqr.independent U=0 sz=2}
Run #3: ActivityRecord{52a305fc u0 com.amqr.taskaffinity2/.App2Other t91}
TaskRecord{52ac226c #92 A=com.amqr.taskaffinity2 U=0 sz=1}
Run #2: ActivityRecord{52aba490 u0 com.amqr.taskaffinity2/.MainActivity2 t92}
TaskRecord{52a8eab0 #91 A=com.amqr.independent U=0 sz=2}
Run #1: ActivityRecord{529208ac u0 com.amqr.taskaffinity1/.App1Other t91}
TaskRecord{52997fe8 #90 A=com.amqr.taskaffinity1 U=0 sz=1}
Run #0: ActivityRecord{52947afc u0 com.amqr.taskaffinity1/.MainActivity1 t90}
====== 我们加多一个页面,一样singleTask+tsakAffinity,由app2的other页面接着打开
Recent tasks:
* Recent #0: TaskRecord{52a8d110 #100 A=com.amqr.independent U=0 sz=3}
* Recent #1: TaskRecord{52a9d0f4 #101 A=com.amqr.taskaffinity2 U=0 sz=1}
* Recent #2: TaskRecord{5295e6f8 #1 A=com.android.launcher U=0 sz=1}
* Recent #3: TaskRecord{529c16d8 #99 A=com.amqr.taskaffinity1 U=0 sz=1}
* Recent #4: TaskRecord{52ab46ac #98 A=com.android.systemui U=0 sz=0}
Running activities (most recent first):
TaskRecord{52a8d110 #100 A=com.amqr.independent U=0 sz=3}
Run #4: ActivityRecord{52a92c0c u0 com.amqr.taskaffinity2/.App2_3Activity t100}
Run #3: ActivityRecord{52a4f4d8 u0 com.amqr.taskaffinity2/.App2Other t100}
TaskRecord{52a9d0f4 #101 A=com.amqr.taskaffinity2 U=0 sz=1}
Run #2: ActivityRecord{5299485c u0 com.amqr.taskaffinity2/.MainActivity2 t101}
TaskRecord{52a8d110 #100 A=com.amqr.independent U=0 sz=3}
Run #1: ActivityRecord{52987b44 u0 com.amqr.taskaffinity1/.App1Other t100}
TaskRecord{529c16d8 #99 A=com.amqr.taskaffinity1 U=0 sz=1}
Run #0: ActivityRecord{529835bc u0 com.amqr.taskaffinity1/.MainActivity1 t99}