Move stack to front in-sync with task reparenting

When reparenting a task to another stack have window manager move the
destination stack to the front at the same time it is reparenting the
task if REPARENT_MOVE_STACK_TO_FRONT is set to avoid jank.

Test: manual
Bug: 37299899
Change-Id: I45678e742188a4871f93a11178f7ab2b60c7bcc3
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 5c46ca9..4262d12 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -184,7 +184,7 @@
         super.removeImmediately();
     }
 
-    void reparent(TaskStack stack, int position) {
+    void reparent(TaskStack stack, int position, boolean moveParents) {
         if (stack == mStack) {
             throw new IllegalArgumentException(
                     "task=" + this + " already child of stack=" + mStack);
@@ -195,7 +195,7 @@
         final DisplayContent prevDisplayContent = getDisplayContent();
 
         getParent().removeChild(this);
-        stack.addTask(this, position, showForAllUsers(), false /* moveParents */);
+        stack.addTask(this, position, showForAllUsers(), moveParents);
 
         // Relayout display(s).
         final DisplayContent displayContent = stack.getDisplayContent();