From 19d9bd54d3d09075b3fd5c57a5e4fc1a16f9c826 Mon Sep 17 00:00:00 2001 From: Craig Mautner Date: Mon, 21 Oct 2013 20:05:26 -0700 Subject: [PATCH] Do not delete stacks that are not empty. The possibility existed that an activity was set to a task that it was already being set to. If that were to happen, and it was the only activity in the only task of the stack the stack would be deleted. This fixes that situation and logs it as well to confirm that it does fix bug 11272935. Logging to be deleted upon successful monkey run exhibiting the log. Change-Id: I436fdcc9a3734adad81d3ef90f29b93b3ac4dfcd --- services/java/com/android/server/am/ActivityRecord.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java index cf686672a2a3e..49f29fe6c372f 100644 --- a/services/java/com/android/server/am/ActivityRecord.java +++ b/services/java/com/android/server/am/ActivityRecord.java @@ -480,7 +480,12 @@ final class ActivityRecord { void setTask(TaskRecord newTask, ThumbnailHolder newThumbHolder, boolean isRoot) { if (task != null && task.removeActivity(this)) { - mStackSupervisor.removeTask(task); + if (task != newTask) { + mStackSupervisor.removeTask(task); + } else { + Slog.d(TAG, "!!! REMOVE THIS LOG !!! setTask: nearly removed stack=" + + (newTask == null ? null : newTask.stack)); + } } if (inHistory && !finishing) { if (task != null) {