Stop task reparenting when enter/exit PIP.

With only one activity in the PIP task, we can simply change the
windowing mode (this was already done implicitly when re-parenting) and
let the display know the existing stack is the new pinned stack as
opposed to creating a new stack just to move the task over.

With multiple activities, we will remain moving the PIP activity into a
separate stack, but we will move it to a stack with the same windowing
mode as the original rather than a pinned one. Then, we will do a
windowing mode change on it also, so it performs the same as the single
activity case.

When exiting, we then simply do a windowing mode change.

Bug: 143772438
Test: Try PIP with one activity (e.g. Youtube) and multiple activities
(VLC), enter/exits works fine. atest PinnedStackTests
Change-Id: Ie961e120762e5e244f14b6ac181509656b107969
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 222f26e..a192599 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -4010,7 +4010,7 @@
                     stack.animateResizePinnedStack(null /* sourceHintBounds */,
                             null /* destBounds */, animationDuration, false /* fromFullscreen */);
                 } else {
-                    mStackSupervisor.moveTasksToFullscreenStackLocked(stack, true /* onTop */);
+                    stack.dismissPip();
                 }
             }
         } finally {
@@ -4026,11 +4026,6 @@
         }
     }
 
-    /**
-     * NOTE: For the pinned stack, this method is usually called after the bounds animation has
-     *       animated the stack to the fullscreen, but can also be called if we are relaunching an
-     *       activity and clearing the task at the same time.
-     */
     @Override
     // TODO: API should just be about changing windowing modes...
     public void moveTasksToFullscreenStack(int fromStackId, boolean onTop) {