1. Main, Test, Test2 are all standard
Running process: Main -> Test - FLAG_ACTIVITY_NEW_TASK (startup mode) ->Test2 -FLAG_ACTIVITY_NEW_TASK ->Test
Observed through adb shell dumpsys activity activities, there is only one stack
Conclusion: As Google said, the performance of FLAG_ACTIVITY_NEW_TASK is the same as that of singleTask, multiple FLAG_ACTIVITY_NEW_TASK, if there is already a stack before, the test is the default stack of the app, in fact it only operates in one stack
2.Main, Test, is standard, Test2 is singleInstance
Main -> Test ->Test2 ->Test
Observed through adb shell dumpsys activity activities, there are two stacks, Test2 has one stack, and the rest Test and Main have a stack
Conclusion: Do not specify the startup mode, for Test2 start in its own stack, other activities start in the app default stack
3.Main, Test, is standard, Test2 is singleInstance
Main -> Test - FLAG_ACTIVITY_NEW_TASK (startup mode) ->Test2 -FLAG_ACTIVITY_NEW_TASK ->Test
Observed through adb shell dumpsys activity activities, there are two stacks, Test2 has one stack, and the rest Test and Main have a stack
Conclusion: Although FLAG_ACTIVITY_NEW_TASK is used to start, according to test 1, so for Test2 to start in its own stack, other activities are still started in the app's default stack, because when the Test is started from Test2, Test already has a stack that can be stored, so there is no need to create a new stack.