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

Commit c17c4f60 authored by Merissa Mitchell's avatar Merissa Mitchell Committed by Android (Google) Code Review
Browse files

Merge "Prevent PiP and Bubble from overlapping." into main

parents ef537f50 569d43f3
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);
    }

    /**