Don't move stack to bottom when creating task at bottom

When creating a task, only move the parents of the task if we are creating
the task at the top of the stack. i.e. creating the task at the top of its
stack will move the stack forward and creating the task at the bottom of
the stack shouldn't move the stack backwards. Creating a task at the bottom
is used for things like restoring a task from recents to use for other things
and for background user, so shouldn't affect visibility of its parent stack.

Change-Id: Ifcaf7c5a95294631dff675ac5c7d87f059b1792a
Fixes: 62352722
Test: go/wm-smoke
diff --git a/services/core/java/com/android/server/wm/TaskWindowContainerController.java b/services/core/java/com/android/server/wm/TaskWindowContainerController.java
index 9f02485..54a6cc0 100644
--- a/services/core/java/com/android/server/wm/TaskWindowContainerController.java
+++ b/services/core/java/com/android/server/wm/TaskWindowContainerController.java
@@ -80,7 +80,9 @@
             final Task task = createTask(taskId, stack, userId, bounds, overrideConfig, resizeMode,
                     supportsPictureInPicture, homeTask, taskDescription);
             final int position = toTop ? POSITION_TOP : POSITION_BOTTOM;
-            stack.addTask(task, position, showForAllUsers, true /* moveParents */);
+            // We only want to move the parents to the parents if we are creating this task at the
+            // top of its stack.
+            stack.addTask(task, position, showForAllUsers, toTop /* moveParents */);
         }
     }