Fix issue with aspect ratio not applying correctly when PIP is expanded
- The current code always used the default min edge size to calculate the
PIP bounds when the aspect ratio changes, so if a PIP app sets the aspect
ratio in response to the an action, the bounds would be resized down
incorrectly.
- This CL fixes the issue with current aspect ratio not being initialized
correctly, and also ensures that SystemUI always updates the min edge
size when expanding the PIP.
Bug: 38324839
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: go/wm-smoke
Change-Id: Ida0f68b2f8f93f9bf1915dda8762a156704d4709
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index e180aef..e828d38 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -2989,8 +2989,8 @@
// Calculate the default bounds (don't use existing stack bounds as we may have just created
// the stack, and schedule the start of the animation into PiP (the bounds animator that
// is triggered by this is posted on another thread)
- final Rect destBounds = stack.getPictureInPictureBounds(aspectRatio,
- false /* useExistingStackBounds */);
+ final Rect destBounds = stack.getDefaultPictureInPictureBounds(aspectRatio);
+
stack.animateResizePinnedStack(sourceHintBounds, destBounds, -1 /* animationDuration */,
true /* fromFullscreen */);