Do not use docked stack bounds unless all conditions are met.

TaskStack currently refers to the DockedStackDividerControler to
calculate the docked stack. However, only a partial set of the
conditions when this is valid were mirrored. The code now checks the
base condition (that we are dealing with the docked stack) and then
checks a null value before applying. Null is passed back from the
controller in the case all conditions are not met.

Change-Id: I388c2eb0b8b9312cd9ee6380ace1837e2eca8450
Fixes: 35233502
Test: manual from bug repro steps.
(cherry picked from commit fa378d84a2ee574782a2185abad0bc72d5dd22c8)
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index 544d1e3..b09d699 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -423,8 +423,12 @@
         mBoundsAfterRotation.setEmpty();
         final DockedStackDividerController controller = getDisplayContent()
                 .mDividerControllerLocked;
-        if (controller.isMinimizedDock() && mStackId == DOCKED_STACK_ID) {
-            outTempBounds.set(controller.getMiddlePositionDockedStackRect());
+        if (mStackId == DOCKED_STACK_ID) {
+            final Rect dockedStackRect = controller.getMiddlePositionDockedStackRect();
+
+            if (dockedStackRect != null) {
+                outTempBounds.set(dockedStackRect);
+            }
         }
     }