Update task orgs with existing tasks

- Move stack task org calls up to task
- If the task organizer dies, reset the last cached wm mode and update
  all existing tasks when the task organizer is next re-registered. This
  only applies to the first task organizer for a given windowing mode
  to ensure that the testing strategy of only reporting new tasks to
  current task organizers still applies.

Bug: 150874492
Test: atest WmTests:TaskOrganizerTests
Test: Move pip, kill sysui, ensure sysui still controls pip task
Change-Id: Ib266f67243ea215940747d57022d3aa91d55dff8
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
index eed81bf..20ec05b 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
@@ -232,6 +232,12 @@
                 mTouchHandler.getMotionHelper());
         displayController.addDisplayChangingController(mRotationController);
 
+        // Ensure that we have the display info in case we get calls to update the bounds before the
+        // listener calls back
+        final DisplayInfo displayInfo = new DisplayInfo();
+        context.getDisplay().getDisplayInfo(displayInfo);
+        mPipBoundsHandler.onDisplayInfoChanged(displayInfo);
+
         try {
             ActivityTaskManager.getTaskOrganizerController().registerTaskOrganizer(
                     mPipTaskOrganizer, WINDOWING_MODE_PINNED);