diff options
author | 2017-03-03 15:16:50 +0000 | |
---|---|---|
committer | 2017-03-03 15:16:53 +0000 | |
commit | a6d6e60e0058fa29e5f20e981f13f78ace3e3573 (patch) | |
tree | 2454689bc8d15d97af7994984d6206698e77ef59 | |
parent | b85a22ca090615c1ee33a31c444a3d15a6a56341 (diff) | |
parent | 41801b43d86bbca4e7b98993d8d573cee75b0ae1 (diff) |
Merge "Save TaskRecord before calling performClearTaskLocked."
-rw-r--r-- | services/core/java/com/android/server/am/ActivityStarter.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java index 2e33c6254c11..b9ae4fd4f7b3 100644 --- a/services/core/java/com/android/server/am/ActivityStarter.java +++ b/services/core/java/com/android/server/am/ActivityStarter.java @@ -1561,9 +1561,13 @@ class ActivityStarter { == (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK)) { // The caller has requested to completely replace any existing task with its new // activity. Well that should not be too hard... - intentActivity.task.performClearTaskLocked(); - intentActivity.task.setIntent(mStartActivity); + // Note: we must persist the {@link TaskRecord} first as intentActivity could be + // removed from calling performClearTaskLocked (For example, if it is being brought out + // of history or if it is finished immediately), thus disassociating the task. mReuseTask = intentActivity.task; + mReuseTask.performClearTaskLocked(); + mReuseTask.setIntent(mStartActivity); + // When we clear the task - focus will be adjusted, which will bring another task // to top before we launch the activity we need. This will temporary swap their // mTaskToReturnTo values and we don't want to overwrite them accidentally. |