Fix issue #6745498: Cannot view consecutive event details from agenda view
- There was a long-standing bug when using FLAG_ACTIVITY_REORDER_TO_FRONT
where we could find and use an activity that is currently finishing.
- There was a recently introduced bug where activities being destroyed
would not be removed from the history stack at the time they are done
being destroyed, allowing the above bug to be exposed.
- Removing a task would not kill any processes associated with the app
that had a different name from the app itself.
Change-Id: I4401ab6d348a69e1ac4fb8f719d2c69d5a78e567
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index b276494..9171e47 100755
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -2347,6 +2347,9 @@
while (i > 0) {
i--;
ActivityRecord candidate = mHistory.get(i);
+ if (candidate.finishing) {
+ continue;
+ }
if (candidate.task.taskId != task) {
break;
}
@@ -4057,7 +4060,7 @@
int index = indexOfActivityLocked(r);
if (index >= 0) {
if (r.state == ActivityState.DESTROYING) {
- cleanUpActivityLocked(r, true, true);
+ cleanUpActivityLocked(r, true, false);
removeActivityFromHistoryLocked(r);
}
}