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

Commit 65c66bde authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ignore resize request when exiting PiP" into rvc-dev

parents 1262dc84 0eb6ecff
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -619,7 +619,9 @@ public class PipTaskOrganizer extends TaskOrganizer implements
            @PipAnimationController.TransitionDirection int direction, int durationMs,
            Consumer<Rect> updateBoundsCallback) {
        if (!mInPip) {
            // can be initiated in other component, ignore if we are no longer in PIP
            // TODO: tend to use shouldBlockResizeRequest here as well but need to consider
            // the fact that when in exitPip, scheduleAnimateResizePip is executed in the window
            // container transaction callback and we want to set the mExitingPip immediately.
            return;
        }

@@ -675,8 +677,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
    private void scheduleFinishResizePip(Rect destinationBounds,
            @PipAnimationController.TransitionDirection int direction,
            Consumer<Rect> updateBoundsCallback) {
        if (!mInPip) {
            // can be initiated in other component, ignore if we are no longer in PIP
        if (shouldBlockResizeRequest()) {
            return;
        }

@@ -704,8 +705,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
     */
    public void scheduleOffsetPip(Rect originalBounds, int offset, int duration,
            Consumer<Rect> updateBoundsCallback) {
        if (!mInPip) {
            // can be initiated in other component, ignore if we are no longer in PIP
        if (shouldBlockResizeRequest()) {
            return;
        }
        if (mShouldDeferEnteringPip) {
@@ -876,6 +876,16 @@ public class PipTaskOrganizer extends TaskOrganizer implements
                : params.getAspectRatio();
    }

    /**
     * Resize request can be initiated in other component, ignore if we are no longer in PIP
     * or we're exiting from it.
     *
     * @return {@code true} if the resize request should be blocked/ignored.
     */
    private boolean shouldBlockResizeRequest() {
        return !mInPip || mExitingPip;
    }

    /**
     * Sync with {@link #mSplitDivider} on destination bounds if PiP is going to split screen.
     *
+5 −2
Original line number Diff line number Diff line
@@ -533,8 +533,11 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
                && !mSpringingToTouch
                && !mMagnetizedPip.getObjectStuckToTarget()) {
            mBounds.set(mTemporaryBounds);
            if (!mDismissalPending) {
                // do not schedule resize if PiP is dismissing, which may cause app re-open to
                // mBounds instead of it's normal bounds.
                mPipTaskOrganizer.scheduleFinishResizePip(mBounds);

            }
            mTemporaryBounds.setEmpty();
        }