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

Commit 11112619 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...

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

Change-Id: I9cf75c0e6fadc0aa78746e56e40016c9e403d401
parents d41aa231 013a422e
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) {