Don't remove task from recents when moving task to another stack.
Also, made event log reason for remove task when moving different
from when removing.
Bug: 19946163
Change-Id: Iea2b7a84040759e9ad0a7dc8c6f4aee67b15467b
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index a8deea3..048380d 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -4208,14 +4208,22 @@
}
void removeTask(TaskRecord task, String reason) {
- removeTask(task, reason, true);
+ removeTask(task, reason, true /* notMoving */);
}
- void removeTask(TaskRecord task, String reason, boolean removeFromWindowManager) {
- mStackSupervisor.endLockTaskModeIfTaskEnding(task);
- if (removeFromWindowManager) {
+ /**
+ * Removes the input task from this stack.
+ * @param task to remove.
+ * @param reason for removal.
+ * @param notMoving task to another stack. In the case we are moving we don't want to perform
+ * some operations on the task like removing it from window manager or recents.
+ */
+ void removeTask(TaskRecord task, String reason, boolean notMoving) {
+ if (notMoving) {
+ mStackSupervisor.endLockTaskModeIfTaskEnding(task);
mWindowManager.removeTask(task.taskId);
}
+
final ActivityRecord r = mResumedActivity;
if (r != null && r.task == task) {
mResumedActivity = null;
@@ -4232,7 +4240,7 @@
mTaskHistory.remove(task);
updateTaskMovement(task, true);
- if (task.mActivities.isEmpty()) {
+ if (notMoving && task.mActivities.isEmpty()) {
final boolean isVoiceSession = task.voiceSession != null;
if (isVoiceSession) {
try {