summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-06-28 13:49:17 -0700
committerDianne Hackborn <hackbod@google.com>2012-06-28 13:49:17 -0700
commit45a25bcfc9af74bc4275cc710347304e581f3c51 (patch)
tree14a27ab34231d641eba57b9b6b4f4f1898770535
parent9e608c12186d308fb1711e8824901fdf931a3a96 (diff)
downloadframeworks_base-45a25bcfc9af74bc4275cc710347304e581f3c51.zip
frameworks_base-45a25bcfc9af74bc4275cc710347304e581f3c51.tar.gz
frameworks_base-45a25bcfc9af74bc4275cc710347304e581f3c51.tar.bz2
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
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java19
-rwxr-xr-xservices/java/com/android/server/am/ActivityStack.java5
2 files changed, 18 insertions, 6 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index f482552..95d3c41 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -5704,12 +5704,19 @@ public final class ActivityManagerService extends ActivityManagerNative
if (killProcesses) {
// Find any running processes associated with this app.
+ final String pkg = component.getPackageName();
ArrayList<ProcessRecord> procs = new ArrayList<ProcessRecord>();
- SparseArray<ProcessRecord> appProcs
- = mProcessNames.getMap().get(component.getPackageName());
- if (appProcs != null) {
- for (int i=0; i<appProcs.size(); i++) {
- procs.add(appProcs.valueAt(i));
+ HashMap<String, SparseArray<ProcessRecord>> pmap = mProcessNames.getMap();
+ for (SparseArray<ProcessRecord> uids : pmap.values()) {
+ for (int i=0; i<uids.size(); i++) {
+ ProcessRecord proc = uids.valueAt(i);
+ if (proc.userId != tr.userId) {
+ continue;
+ }
+ if (!proc.pkgList.contains(pkg)) {
+ continue;
+ }
+ procs.add(proc);
}
}
@@ -5720,6 +5727,7 @@ public final class ActivityManagerService extends ActivityManagerNative
Slog.i(TAG, "Killing " + pr.toShortString() + ": remove task");
EventLog.writeEvent(EventLogTags.AM_KILL, pr.pid,
pr.processName, pr.setAdj, "remove task");
+ pr.killedBackground = true;
Process.killProcessQuiet(pr.pid);
} else {
pr.waitingToKill = "remove task";
@@ -14634,6 +14642,7 @@ public final class ActivityManagerService extends ActivityManagerNative
Slog.i(TAG, "Killing " + app.toShortString() + ": " + app.waitingToKill);
EventLog.writeEvent(EventLogTags.AM_KILL, app.pid,
app.processName, app.setAdj, app.waitingToKill);
+ app.killedBackground = true;
Process.killProcessQuiet(app.pid);
success = false;
} else {
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 @@ final class ActivityStack {
while (i > 0) {
i--;
ActivityRecord candidate = mHistory.get(i);
+ if (candidate.finishing) {
+ continue;
+ }
if (candidate.task.taskId != task) {
break;
}
@@ -4057,7 +4060,7 @@ final class ActivityStack {
int index = indexOfActivityLocked(r);
if (index >= 0) {
if (r.state == ActivityState.DESTROYING) {
- cleanUpActivityLocked(r, true, true);
+ cleanUpActivityLocked(r, true, false);
removeActivityFromHistoryLocked(r);
}
}