Fixes minimized state to match task and stack bounds for cts test

Fixes minimized state for its task and stack bounds to always match
inline with the cts test that was failing.

This also fixes multiple state issues related to splitting home and
recents into different stacks when recents incorrectly reads home stack
bounds to determine bounds for recents.

Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test
CtsServicesHostTestCases
android.server.cts.ActivityManagerActivityVisibilityTests or
ActivityManagerDockedStackTests
Fixes: 35351074, 35145587
Change-Id: I6417a567e937c647818ff26dc08df463e6ef4257
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 59f58d7..ec05e33 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -2375,19 +2375,19 @@
                 // static stacks need to be adjusted so they don't overlap with the docked stack.
                 // We get the bounds to use from window manager which has been adjusted for any
                 // screen controls and is also the same for all stacks.
-                final Rect tempOtherTaskRect = new Rect();
-                final Rect tempOtherTaskInsetRect = new Rect();
+                final Rect otherTaskRect = new Rect();
                 for (int i = FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
                     final ActivityStack current = getStack(i);
                     if (current != null && StackId.isResizeableByDockedStack(i)) {
-                        current.getStackDockedModeBounds(tempRect, tempOtherTaskRect,
-                                tempOtherTaskInsetRect, true /* ignoreVisibility */);
+                        current.getStackDockedModeBounds(
+                                tempOtherTaskBounds /* currentTempTaskBounds */,
+                                tempRect /* outStackBounds */,
+                                otherTaskRect /* outTempTaskBounds */, true /* ignoreVisibility */);
+
                         resizeStackLocked(i, tempRect,
-                                !tempOtherTaskRect.isEmpty() ? tempOtherTaskRect :
-                                        tempOtherTaskBounds,
-                                !tempOtherTaskInsetRect.isEmpty() ? tempOtherTaskInsetRect :
-                                        tempOtherTaskInsetBounds,
-                                preserveWindows, true /* allowResizeInDockedMode */, deferResume);
+                                !otherTaskRect.isEmpty() ? otherTaskRect : tempOtherTaskBounds,
+                                tempOtherTaskInsetBounds, preserveWindows,
+                                true /* allowResizeInDockedMode */, deferResume);
                     }
                 }
             }