diff options
| author | 2021-05-18 13:27:40 -0700 | |
|---|---|---|
| committer | 2021-05-18 13:29:18 -0700 | |
| commit | 5e946e95aee09dd44c80f372a0277de3219e6525 (patch) | |
| tree | 3245d34a68ab7e23b877f5364c2cd4570c47e636 | |
| parent | a025621bcd3233a4ffab1269d8b640fa40dab165 (diff) | |
Skip finishResize for non-exit animation if PIP is about to exit
This handles the case were exitPip is called while there is a
animateResize PIP ongoing, such the menu expand/unexpand animation.
When that was the case, the first finishResize was applied at the same
time as the exit WCT, resulting in bad frames at the end of the exit
animation.
This CL makes it so that the first finishResize is skipped if we
know exitPip is handling the exit and will eventually call its
own finishResize operation.
Bug: 185306679
Test: enter PIP with YT, tap on menu to show it and immediately
tap on the app launcher icon to expand PIP - verify the exit
transtion runs smoothly
Change-Id: Iac49f69cc698f1ac5d88fd408c204e2281b70ac7
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java | 5 | ||||
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java | 14 |
2 files changed, 17 insertions, 2 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java index 17e0d1bc9018..a2c656713724 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java @@ -89,6 +89,11 @@ public class PipAnimationController { || direction == TRANSITION_DIRECTION_LEAVE_PIP_TO_SPLIT_SCREEN; } + /** Whether the given direction represents removing PIP. */ + public static boolean isRemovePipDirection(@TransitionDirection int direction) { + return direction == TRANSITION_DIRECTION_REMOVE_STACK; + } + private final PipSurfaceTransactionHelper mSurfaceTransactionHelper; private final ThreadLocal<AnimationHandler> mSfAnimationHandlerThreadLocal = 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 b3528712db97..c9d55f6496e9 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 @@ -39,6 +39,7 @@ import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTI import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_USER_RESIZE; import static com.android.wm.shell.pip.PipAnimationController.isInPipDirection; import static com.android.wm.shell.pip.PipAnimationController.isOutPipDirection; +import static com.android.wm.shell.pip.PipAnimationController.isRemovePipDirection; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -185,8 +186,17 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, mDeferredAnimEndTransaction = tx; return; } - finishResize(tx, destinationBounds, direction, animationType); - sendOnPipTransitionFinished(direction); + final boolean isExitPipDirection = isOutPipDirection(direction) + || isRemovePipDirection(direction); + if (mState != State.EXITING_PIP || isExitPipDirection) { + // Finish resize as long as we're not exiting PIP, or, if we are, only if this is + // the end of an exit PIP animation. + // This is necessary in case there was a resize animation ongoing when exit PIP + // started, in which case the first resize will be skipped to let the exit + // operation handle the final resize out of PIP mode. See b/185306679. + finishResize(tx, destinationBounds, direction, animationType); + sendOnPipTransitionFinished(direction); + } if (direction == TRANSITION_DIRECTION_TO_PIP) { // TODO (b//169221267): Add jank listener for transactions without buffer updates. //InteractionJankMonitor.getInstance().end( |