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

Commit 52d82da7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Ignore resize request when exiting PiP" into rvc-dev am: 65c66bde am: b96c0189

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12004845

Change-Id: I4785026a83e154f726e615d928e72c2f6c270785
parents 7ed462db b96c0189
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();
        }