Prevent home task from being set as ontopofhome
If the front activity of a task that is on top of home finishes, the oldest task in
other stacks will be set as ontopofhome (which in this case meant the
home task was set to ontopofhome). The solution is to ensure we
only set a task to ontopofhome if the finishing activity is in the same
stack.
Change-Id: Idd8f9af4d3d9bd2de3c519d3dcc60f479695ae0c
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 442da31..5b0c12c 100755
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -1417,7 +1417,8 @@
final TaskRecord nextTask = next.task;
final TaskRecord prevTask = prev != null ? prev.task : null;
- if (prevTask != null && prevTask.mOnTopOfHome && prev.finishing && prev.frontOfTask) {
+ if (prevTask != null && prevTask.stack == this &&
+ prevTask.mOnTopOfHome && prev.finishing && prev.frontOfTask) {
if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
if (prevTask == nextTask) {
prevTask.setFrontOfTask();