summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorCraig Mautner <cmautner@google.com>2015-02-24 10:53:03 -0800
committerCraig Mautner <cmautner@google.com>2015-02-24 11:07:18 -0800
commitacebdc84d182f39add0432b35d974da58f608749 (patch)
treea2cbcba2c14fb2985a86b8555252da509d8c6cb9 /services
parent8ee1d64c0ac3dba3e72fcc3503c7c36397a5ac74 (diff)
downloadframeworks_base-acebdc84d182f39add0432b35d974da58f608749.zip
frameworks_base-acebdc84d182f39add0432b35d974da58f608749.tar.gz
frameworks_base-acebdc84d182f39add0432b35d974da58f608749.tar.bz2
Cleanup the activity before the task and stack
The method cleanupActivityLocked() should be called before removeActivityFromHistoryLocked(). Previously it didn't matter but now that we null TaskRecord.stack when removing the last activity from the task it does. Fixes NPE in bug 19491381. Change-Id: Ia6f8f560c0fe4df330577f313e24d7dd02c18409
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 83a7b68..a0df032 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -2999,6 +2999,8 @@ final class ActivityStack {
* representation) and cleaning things up as a result of its hosting
* processing going away, in which case there is no remaining client-side
* state to destroy so only the cleanup here is needed.
+ *
+ * Note: Call before #removeActivityFromHistoryLocked.
*/
final void cleanUpActivityLocked(ActivityRecord r, boolean cleanServices,
boolean setState) {
@@ -3410,7 +3412,7 @@ final class ActivityStack {
if (DEBUG_CLEANUP) Slog.v(
TAG, "Record #" + i + " " + r + ": app=" + r.app);
if (r.app == app) {
- boolean remove;
+ final boolean remove;
if ((!r.haveState && !r.stateNotNeeded) || r.finishing) {
// Don't currently have state for the activity, or
// it is finishing -- always remove it.
@@ -3444,8 +3446,6 @@ final class ActivityStack {
mService.updateUsageStats(r, false);
}
}
- removeActivityFromHistoryLocked(r, "appDied");
-
} else {
// We have the current state for this activity, so
// it can be restarted later when needed.
@@ -3464,8 +3464,10 @@ final class ActivityStack {
r.icicle = null;
}
}
-
cleanUpActivityLocked(r, true, true);
+ if (remove) {
+ removeActivityFromHistoryLocked(r, "appDied");
+ }
}
}
}