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

Commit f9eacfff authored by Hongwei Wang's avatar Hongwei Wang Committed by Automerger Merge Worker
Browse files

Merge "Work around for display info mismatch during the PiP transition" into rvc-dev am: dbb9d141

Change-Id: I84b687db972f15e192a2166b41da912231baee1d
parents 8458f4d1 dbb9d141
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -110,6 +110,10 @@ public class PipAnimationController {
        return mCurrentAnimator;
    }

    PipTransitionAnimator getCurrentAnimator() {
        return mCurrentAnimator;
    }

    private PipTransitionAnimator setupPipTransitionAnimator(PipTransitionAnimator animator) {
        animator.setSurfaceTransactionHelper(mSurfaceTransactionHelper);
        animator.setInterpolator(mFastOutSlowInInterpolator);
@@ -239,6 +243,9 @@ public class PipAnimationController {

        void setDestinationBounds(Rect destinationBounds) {
            mDestinationBounds.set(destinationBounds);
            if (mAnimationType == ANIM_TYPE_ALPHA) {
                onStartTransaction(mLeash, newSurfaceControlTransaction());
            }
        }

        void setCurrentValue(T value) {
+4 −0
Original line number Diff line number Diff line
@@ -199,6 +199,10 @@ public class PipBoundsHandler {
        return mLastDestinationBounds;
    }

    public Rect getDisplayBounds() {
        return new Rect(0, 0, mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight);
    }

    /**
     * Responds to IPinnedStackListener on {@link DisplayInfo} change.
     * It will normally follow up with a
+23 −0
Original line number Diff line number Diff line
@@ -318,6 +318,29 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub {
                null /* updateBoundsCallback */);
    }

    /**
     * TODO(b/152809058): consolidate the display info handling logic in SysUI
     */
    @SuppressWarnings("unchecked")
    public void mayUpdateCurrentAnimationOnRotationChange() {
        final PipAnimationController.PipTransitionAnimator animator =
                mPipAnimationController.getCurrentAnimator();
        if (animator != null && animator.isRunning()
                && animator.getTransitionDirection() == TRANSITION_DIRECTION_TO_PIP) {
            final Rect currentDestinationBounds = animator.getDestinationBounds();
            if (mPipBoundsHandler.getDisplayBounds().contains(currentDestinationBounds)) {
                return;
            }
            final Rect newDestinationBounds = mPipBoundsHandler.getDestinationBounds(
                    getAspectRatioOrDefault(mTaskInfo.pictureInPictureParams),
                    null /* bounds */, getMinimalSize(mTaskInfo.topActivityInfo));
            if (animator.getAnimationType() == ANIM_TYPE_BOUNDS) {
                animator.updateEndValue(newDestinationBounds);
            }
            animator.setDestinationBounds(newDestinationBounds);
        }
    }

    /**
     * @return {@code true} if the aspect ratio is changed since no other parameters within
     * {@link PictureInPictureParams} would affect the bounds.
+1 −0
Original line number Diff line number Diff line
@@ -363,6 +363,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
        mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds,
                animatingBounds, fromImeAdjustment, fromShelfAdjustment,
                mTmpDisplayInfo.rotation);
        mPipTaskOrganizer.mayUpdateCurrentAnimationOnRotationChange();
    }

    public void dump(PrintWriter pw) {