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

Commit 569d43f3 authored by Merissa Mitchell's avatar Merissa Mitchell
Browse files

Prevent PiP and Bubble from overlapping.

This is a partial fix for b/222229398.

Recall: http://recall/clips/ebd8432c-6b03-4ceb-9ca1-1b18dad59b64

Bug: 222229398
Test: atest WMShellFlickerTestsPip2
Test: atest WMShellUnitTests
Test: Launch a PiP window and a bubble. Move the PiP window on top of
the bubble and verify the bubble moves out of the way.
Flag: EXEMPT bug fix

Change-Id: I2136de50350cefa8f0aae216c4d6a63f7f8df1cb
parent fa94f9b5
Loading
Loading
Loading
Loading
+6 −14
Original line number Diff line number Diff line
@@ -204,8 +204,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
    @NonNull
    @Override
    public Rect getFloatingBoundsOnScreen() {
        return !mPipBoundsState.getMotionBoundsState().getAnimatingToBounds().isEmpty()
                ? mPipBoundsState.getMotionBoundsState().getAnimatingToBounds() : getBounds();
        return getBounds();
    }

    @NonNull
@@ -616,7 +615,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
            cancelPhysicsAnimation();
        }

        setAnimatingToBounds(new Rect(
        mPipBoundsState.getMotionBoundsState().setAnimatingToBounds(new Rect(
                (int) toX,
                (int) toY,
                (int) toX + getBounds().width(),
@@ -660,6 +659,9 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
            // All motion operations have actually finished.
            mPipBoundsState.setBounds(
                    mPipBoundsState.getMotionBoundsState().getBoundsInMotion());
            // Notifies the floating coordinator that we moved, so we return these bounds from
            // {@link FloatingContentCoordinator.FloatingContent#getFloatingBoundsOnScreen()}.
            mFloatingContentCoordinator.onContentMoved(this);
            mPipBoundsState.getMotionBoundsState().onAllAnimationsEnded();
            if (!mDismissalPending) {
                // do not schedule resize if PiP is dismissing, which may cause app re-open to
@@ -673,16 +675,6 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
        cleanUpHighPerfSessionMaybe();
    }

    /**
     * Notifies the floating coordinator that we're moving, and sets the animating to bounds so
     * we return these bounds from
     * {@link FloatingContentCoordinator.FloatingContent#getFloatingBoundsOnScreen()}.
     */
    private void setAnimatingToBounds(Rect bounds) {
        mPipBoundsState.getMotionBoundsState().setAnimatingToBounds(bounds);
        mFloatingContentCoordinator.onContentMoved(this);
    }

    /**
     * Directly resizes the PiP to the given {@param bounds}.
     */
@@ -712,7 +704,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
        // This is so all the proper callbacks are performed.
        mPipTaskOrganizer.scheduleAnimateResizePip(toBounds, duration,
                TRANSITION_DIRECTION_EXPAND_OR_UNEXPAND, null /* updateBoundsCallback */);
        setAnimatingToBounds(toBounds);
        mPipBoundsState.getMotionBoundsState().setAnimatingToBounds(toBounds);
    }

    /**