From 771b7796214bb9da73d10cc583f9ab336ed40d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Ciche=C5=84ski?= Date: Tue, 27 Jun 2023 02:51:26 +0000 Subject: [PATCH] Make PipTransition use animators bounds for unhandled case PipTransition is the last one to handle the rotation. It is first going through PipController.mRotationController, which sets the bounds to value A, then PipKeepClearAlgorithm updates those to B due to IME or shelf height adjustments, and finally PipTransition performs an unhandled PiP transition, but still uses the bounds from A, which are missing the keep clear area adjustment. The events are disjoint and we shouldn't rely on their ordering, hence keep clear area change should keep triggering animation. There is still a small flicker visible if the distance to travel by PiP is large (like with IME), because at that point the PipTransition callback comes before the animator finishes, thus putting it in the final position before the animators end through the finishTransaction. Bug: 285242520 Test: before http://recall/-/ekEuGtt9d9HWqkUtAzpHx8/cLtiXGYUyItm2kNCCEkkWA Test: after http://recall/-/ekEuGtt9d9HWqkUtAzpHx8/iPs6fwdSXG3TE0IERmxA8 Change-Id: I713a02ae90c8bdd6ff11e43a5c4f9ff959d2342e --- .../Shell/src/com/android/wm/shell/pip/PipTransition.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java index 24aaa9b75ebe6..e0b494695ae85 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java @@ -1050,7 +1050,7 @@ public class PipTransition extends PipTransitionController { // When the PIP window is visible and being a part of the transition, such as display // rotation, we need to update its bounds and rounded corner. final SurfaceControl leash = pipChange.getLeash(); - final Rect destBounds = mPipBoundsState.getBounds(); + final Rect destBounds = mPipOrganizer.getCurrentOrAnimatingBounds(); final boolean isInPip = mPipTransitionState.isInPip(); mSurfaceTransactionHelper .crop(startTransaction, leash, destBounds)