From 13e125be685d8ea59a351cec8d95a2f8a44b24b1 Mon Sep 17 00:00:00 2001 From: Ben Lin Date: Fri, 15 May 2020 15:01:07 -0700 Subject: [PATCH] When entering PIP with multi-activity, re-use mLastNonFullscreenBounds. In freeform support, we use mLastNonFullScreenBounds to keep track of the task's bounds in freeform. Such that when maximizing/entering PIP, it can restore to this bound after un-maximize/exiting PIP. However when creating a new stack (in the case of multiple-activity in the task, such as VLC), this information gets lost. We will reuse the current task's lastNonfullscreenBounds. Bug: 156780576 Test: In freeform, enter PIP using Multi-activity PIP (e.g. VLC), expand PIP, the PIP activity is using the same bounds as before Change-Id: Ic633fd1704c6e909fef0c2bd2dfe4bd9e2ca53ae --- .../core/java/com/android/server/wm/RootWindowContainer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java index c93b7354999bd..6ad1f87509470 100644 --- a/services/core/java/com/android/server/wm/RootWindowContainer.java +++ b/services/core/java/com/android/server/wm/RootWindowContainer.java @@ -2176,6 +2176,10 @@ class RootWindowContainer extends WindowContainer // move the PIP activity into the task. stack = taskDisplayArea.createStack(WINDOWING_MODE_UNDEFINED, r.getActivityType(), ON_TOP, r.info, r.intent, false /* createdByOrganizer */); + // It's possible the task entering PIP is in freeform, so save the last + // non-fullscreen bounds. Then when this new PIP task exits PIP, it can restore + // to its previous freeform bounds. + stack.setLastNonFullscreenBounds(task.mLastNonFullscreenBounds); // There are multiple activities in the task and moving the top activity should // reveal/leave the other activities in their original task.