From 2a68fc0b1ad80a7e21b2cb62b019adec75d93564 Mon Sep 17 00:00:00 2001 From: "jorgegil@google.com" Date: Fri, 20 May 2022 11:08:18 -0700 Subject: [PATCH] Allow overridding the exitPip destination bounds Allows vendors to choose to restore to bounds other than the display bounds on exit PIP. This is specially useful in freeform enabled desktops where the previous windowing mode was freeform and PIP should return to its original freeform bounds. Bug: 225294296 Test: atest PinnedStackTests Change-Id: Id25906c4b11e5f3c8351ba96cff80c63a6a5cf4e --- .../src/com/android/wm/shell/pip/PipTaskOrganizer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java index b3eb0e155a349..cb75fe77a5e35 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java @@ -434,7 +434,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } } - final Rect destinationBounds = mPipBoundsState.getDisplayBounds(); + final Rect destinationBounds = getExitDestinationBounds(); final int direction = syncWithSplitScreenBounds(destinationBounds, requestEnterSplit) ? TRANSITION_DIRECTION_LEAVE_PIP_TO_SPLIT_SCREEN : TRANSITION_DIRECTION_LEAVE_PIP; @@ -489,6 +489,11 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, }); } + /** Returns the bounds to restore to when exiting PIP mode. */ + public Rect getExitDestinationBounds() { + return mPipBoundsState.getDisplayBounds(); + } + private void exitLaunchIntoPipTask(WindowContainerTransaction wct) { wct.startTask(mTaskInfo.launchIntoPipHostTaskId, null /* ActivityOptions */); mTaskOrganizer.applyTransaction(wct);