From 221457f00bb6e323aa57957392aafc549207653d Mon Sep 17 00:00:00 2001 From: Ikram Gabiyev Date: Tue, 2 Jan 2024 16:49:45 -0800 Subject: [PATCH] Send app bounds to Shell via stopSwipePipToHome Send app bounds used for content overlay by launcher to Shell's PiP component. This is used by Shell to reset overlay scale and offset properly after the enter animation but before the overlay fades out to avoid icon shifts. We observed that app bounds can be different depending on whether we are at 90 deg or 270 deg before fixed rotation. Moreover, the presence of the taskbar can also alter the app bounds. So supplying the app bounds we take from task view simulator to Shell should solve the issue in general. Flag: NONE Bug: 316993346 Test: manually enter PiP w/ fixed rotation in 90 or 270 deg Change-Id: I0a26b0c69020dae399d6794d36a9f3bc8425f40b --- quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java | 3 ++- quickstep/src/com/android/quickstep/SystemUiProxy.java | 5 +++-- .../com/android/quickstep/util/SwipePipToHomeAnimator.java | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index d7ff59e2eb..0f931ca418 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1574,7 +1574,8 @@ public abstract class AbsSwipeUpHandler, mSwipePipToHomeAnimator.getTaskId(), mSwipePipToHomeAnimator.getComponentName(), mSwipePipToHomeAnimator.getDestinationBounds(), - mSwipePipToHomeAnimator.getContentOverlay()); + mSwipePipToHomeAnimator.getContentOverlay(), + mSwipePipToHomeAnimator.getAppBounds()); windowAnim = mSwipePipToHomeAnimators; } else { diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 94ed5b9cb0..a8c680958f 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -630,10 +630,11 @@ public class SystemUiProxy implements ISystemUiProxy { * should be responsible for cleaning up the overlay. */ public void stopSwipePipToHome(int taskId, ComponentName componentName, Rect destinationBounds, - SurfaceControl overlay) { + SurfaceControl overlay, Rect appBounds) { if (mPip != null) { try { - mPip.stopSwipePipToHome(taskId, componentName, destinationBounds, overlay); + mPip.stopSwipePipToHome(taskId, componentName, destinationBounds, overlay, + appBounds); } catch (RemoteException e) { Log.w(TAG, "Failed call stopSwipePipToHome"); } diff --git a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java index fe6ce46072..f3ae4b1acd 100644 --- a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java +++ b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java @@ -265,6 +265,10 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim { return mDestinationBounds; } + public Rect getAppBounds() { + return mAppBounds; + } + @Nullable public SurfaceControl getContentOverlay() { return mPipContentOverlay == null ? null : mPipContentOverlay.getLeash();