Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c19166c authored by jorgegil@google.com's avatar jorgegil@google.com
Browse files

Synchronize destination bounds after rotation in MotionHelper

Make sure that the bounds state is updated with the final
destination bounds after a rotation *before* sending the
pip animation finished & cancelled callbacks.
This ensures that the MotionHelper bounds are synchronized
correctly at the end of the rotation to the post-rotation
bounds and not the pre-rotation bounds by
PipTouchHandler#onPinnedStackAnimationEnded.

Bug: 171352429
Test: Enter PIP, rotate, move PIP - the window doesn't jump
to the pre-rotation bounds when trying to move it.

Change-Id: I36eb192210ec58ac3448c423f43b959ce29eff1f
parent 16b27d50
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -743,6 +743,10 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
        if (animator == null || !animator.isRunning()
        if (animator == null || !animator.isRunning()
                || animator.getTransitionDirection() != TRANSITION_DIRECTION_TO_PIP) {
                || animator.getTransitionDirection() != TRANSITION_DIRECTION_TO_PIP) {
            if (mState.isInPip() && fromRotation) {
            if (mState.isInPip() && fromRotation) {
                // Update bounds state to final destination first. It's important to do this
                // before finishing & cancelling the transition animation so that the MotionHelper
                // bounds are synchronized to the destination bounds when the animation ends.
                mPipBoundsState.setBounds(destinationBoundsOut);
                // If we are rotating while there is a current animation, immediately cancel the
                // If we are rotating while there is a current animation, immediately cancel the
                // animation (remove the listeners so we don't trigger the normal finish resize
                // animation (remove the listeners so we don't trigger the normal finish resize
                // call that should only happen on the update thread)
                // call that should only happen on the update thread)
@@ -756,7 +760,6 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
                    sendOnPipTransitionCancelled(direction);
                    sendOnPipTransitionCancelled(direction);
                    sendOnPipTransitionFinished(direction);
                    sendOnPipTransitionFinished(direction);
                }
                }
                mPipBoundsState.setBounds(destinationBoundsOut);


                // Create a reset surface transaction for the new bounds and update the window
                // Create a reset surface transaction for the new bounds and update the window
                // container transaction
                // container transaction