[ActivityManager] Do not finish root activity when reset task
Symptom: The root activity not always located at index 0 of the task. For example, the index 1 activity will become the new root when the original root activity (at index 0) finished. The new root activity might be finished unexpectedly before the original root activity actually destroyed. Solution: Check frontOfTask to avoid finishing the root activity unexpectedly Change-Id: I623ab97e9c95c83b3cfe7c9dfc151a291a391ea4
This commit is contained in:
@@ -1873,6 +1873,8 @@ final class ActivityStack {
|
||||
final int numActivities = activities.size();
|
||||
for (int i = numActivities - 1; i > 0; --i ) {
|
||||
ActivityRecord target = activities.get(i);
|
||||
if (target.frontOfTask)
|
||||
break;
|
||||
|
||||
final int flags = target.info.flags;
|
||||
final boolean finishOnTaskLaunch =
|
||||
@@ -2040,6 +2042,8 @@ final class ActivityStack {
|
||||
// Do not operate on the root Activity.
|
||||
for (int i = numActivities - 1; i > 0; --i) {
|
||||
ActivityRecord target = activities.get(i);
|
||||
if (target.frontOfTask)
|
||||
break;
|
||||
|
||||
final int flags = target.info.flags;
|
||||
boolean finishOnTaskLaunch = (flags & ActivityInfo.FLAG_FINISH_ON_TASK_LAUNCH) != 0;
|
||||
|
||||
Reference in New Issue
Block a user