Merge "Add a function to get the secondary split screen bounds" into pi-dev
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
index d22aab5..3ecf89c 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
@@ -49,4 +49,9 @@
      * Notifies SystemUI that Overview is shown.
      */
     void onOverviewShown(boolean fromHome) = 6;
+
+    /**
+     * Get the secondary split screen app's rectangle when not minimized.
+     */
+    Rect getNonMinimizedSplitScreenSecondaryBounds() = 7;
 }
diff --git a/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java
index e1540ea..282a8f1 100644
--- a/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java
@@ -22,7 +22,6 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.ServiceConnection;
-import android.content.pm.PackageManager;
 import android.graphics.Rect;
 import android.os.Binder;
 import android.os.Handler;
@@ -42,6 +41,7 @@
 import com.android.systemui.shared.recents.ISystemUiProxy;
 import com.android.systemui.shared.system.ActivityManagerWrapper;
 import com.android.systemui.shared.system.GraphicBufferCompat;
+import com.android.systemui.stackdivider.Divider;
 import com.android.systemui.statusbar.phone.StatusBar;
 import com.android.systemui.statusbar.policy.CallbackController;
 import com.android.systemui.statusbar.policy.DeviceProvisionedController;
@@ -147,6 +147,19 @@
                 Binder.restoreCallingIdentity(token);
             }
         }
+
+        public Rect getNonMinimizedSplitScreenSecondaryBounds() {
+            long token = Binder.clearCallingIdentity();
+            try {
+                Divider divider = ((SystemUIApplication) mContext).getComponent(Divider.class);
+                if (divider != null) {
+                    return divider.getView().getNonMinimizedSplitScreenSecondaryBounds();
+                }
+                return null;
+            } finally {
+                Binder.restoreCallingIdentity(token);
+            }
+        }
     };
 
     private final BroadcastReceiver mLauncherStateChangedReceiver = new BroadcastReceiver() {
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
index 3d8e037..1149ad1 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
@@ -378,6 +378,23 @@
         return mWindowManagerProxy;
     }
 
+    public Rect getNonMinimizedSplitScreenSecondaryBounds() {
+        calculateBoundsForPosition(mSnapTargetBeforeMinimized.position,
+                DockedDividerUtils.invertDockSide(mDockSide), mOtherTaskRect);
+        switch (mDockSide) {
+            case WindowManager.DOCKED_LEFT:
+                mOtherTaskRect.right -= mStableInsets.right;
+                break;
+            case WindowManager.DOCKED_RIGHT:
+                mOtherTaskRect.left -= mStableInsets.left;
+                break;
+            case WindowManager.DOCKED_TOP:
+                mOtherTaskRect.bottom -= mStableInsets.bottom;
+                break;
+        }
+        return mOtherTaskRect;
+    }
+
     public boolean startDragging(boolean animate, boolean touching) {
         cancelFlingAnimation();
         if (touching) {