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

Commit 2c238661 authored by Merissa Mitchell's avatar Merissa Mitchell
Browse files

[PIP2] Fix stashed state updates.

Recall: http://recall/clips/dac41c2f-66cd-4558-a310-71f81f8819d1

Unstashing PiP via tapping was not working due to PiP stashed state not
being updated correctly, since the stashed state was being checked in
stashEndActionIfNeeded before the PiP bounds was updated internally.
This CL updates the logic flow so the stashed status is only checked and
updated after the PiP bounds are updated.

Bug: 374165615
Test: Launch PiP and verify stashing/unstashing works as expected
Flag: com.android.wm.shell.enable_pip2
Change-Id: I3d0787164a98bcabcfe79425b5b6b13eb62e65ba
parent 205cd9fd
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -776,6 +776,10 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
                cancelPhysicsAnimation();
                settlePipBoundsAfterPhysicsAnimation(false /* animatingAfter */);
                break;
            case PipTransitionState.CHANGED_PIP_BOUNDS:
                // Check whether changed bounds imply we need to update stash state too.
                stashEndActionIfNeeded();
                break;
        }
    }

@@ -829,9 +833,6 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
        mPipBoundsState.getMotionBoundsState().onPhysicsAnimationEnded();
        mSpringingToTouch = false;
        mDismissalPending = false;

        // Check whether new bounds after fling imply we need to update stash state too.
        stashEndActionIfNeeded();
    }

    private void stashEndActionIfNeeded() {
+0 −15
Original line number Diff line number Diff line
@@ -1013,21 +1013,6 @@ public class PipTouchHandler implements PipTransitionState.PipTransitionStateCha
            return true;
        }

        private void stashEndAction() {
            if (mPipBoundsState.getBounds().left < 0
                    && mPipBoundsState.getStashedState() != STASH_TYPE_LEFT) {
                mPipUiEventLogger.log(
                        PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_STASH_LEFT);
                mPipBoundsState.setStashed(STASH_TYPE_LEFT);
            } else if (mPipBoundsState.getBounds().left >= 0
                    && mPipBoundsState.getStashedState() != STASH_TYPE_RIGHT) {
                mPipUiEventLogger.log(
                        PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_STASH_RIGHT);
                mPipBoundsState.setStashed(STASH_TYPE_RIGHT);
            }
            mMenuController.hideMenu();
        }

        private void flingEndAction() {
            if (mShouldHideMenuAfterFling) {
                // If the menu is not visible, then we can still be showing the activity for the