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

Commit 42856d04 authored by Mateusz Cicheński's avatar Mateusz Cicheński Committed by Android (Google) Code Review
Browse files

Merge "Enter PiP with fixed rotation restore reentry state correctly" into main

parents a90a5a84 a3f96997
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -228,6 +228,14 @@ public class PipBoundsState {
        mExpandedMovementBounds.set(bounds);
    }

    /** Updates the min and max sizes based on the size spec and aspect ratio. */
    public void updateMinMaxSize(float aspectRatio) {
        final Size minSize = mSizeSpecSource.getMinSize(aspectRatio);
        mMinSize.set(minSize.getWidth(), minSize.getHeight());
        final Size maxSize = mSizeSpecSource.getMaxSize(aspectRatio);
        mMaxSize.set(maxSize.getWidth(), maxSize.getHeight());
    }

    /** Sets the max possible size for resize. */
    public void setMaxSize(int width, int height) {
        mMaxSize.set(width, height);
+1 −0
Original line number Diff line number Diff line
@@ -1037,6 +1037,7 @@ public class PipTransition extends PipTransitionController {
    private void computeEnterPipRotatedBounds(int rotationDelta, int startRotation, int endRotation,
            TaskInfo taskInfo, Rect outDestinationBounds, @Nullable Rect outSourceHintRect) {
        mPipDisplayLayoutState.rotateTo(endRotation);
        mPipBoundsState.updateMinMaxSize(mPipBoundsState.getAspectRatio());

        final Rect displayBounds = mPipDisplayLayoutState.getDisplayBounds();
        outDestinationBounds.set(mPipBoundsAlgorithm.getEntryDestinationBounds());
+8 −0
Original line number Diff line number Diff line
@@ -976,8 +976,16 @@ public class PipController implements PipTransitionController.PipTransitionCallb
        mPipBoundsState.addNamedUnrestrictedKeepClearArea(LAUNCHER_KEEP_CLEAR_AREA_TAG,
                hotseatKeepClearArea);
        onDisplayRotationChangedNotInPip(mContext, launcherRotation);
        // cache current min/max size
        Point minSize = mPipBoundsState.getMinSize();
        Point maxSize = mPipBoundsState.getMaxSize();
        mPipBoundsState.updateMinMaxSize(pictureInPictureParams.getAspectRatioFloat());
        final Rect entryBounds = mPipTaskOrganizer.startSwipePipToHome(componentName, activityInfo,
                pictureInPictureParams);
        // restore min/max size, as this is referenced later in OnDisplayChangingListener and needs
        // to reflect the pre-rotation state for it to work
        mPipBoundsState.setMinSize(minSize.x, minSize.y);
        mPipBoundsState.setMaxSize(maxSize.x, maxSize.y);
        // sync mPipBoundsState with the newly calculated bounds.
        mPipBoundsState.setNormalBounds(entryBounds);
        return entryBounds;
+5 −11
Original line number Diff line number Diff line
@@ -467,17 +467,11 @@ public class PipTouchHandler {
    }

    private void updatePinchResizeSizeConstraints(float aspectRatio) {
        final int minWidth, minHeight, maxWidth, maxHeight;

        minWidth = mSizeSpecSource.getMinSize(aspectRatio).getWidth();
        minHeight = mSizeSpecSource.getMinSize(aspectRatio).getHeight();
        maxWidth = mSizeSpecSource.getMaxSize(aspectRatio).getWidth();
        maxHeight = mSizeSpecSource.getMaxSize(aspectRatio).getHeight();

        mPipResizeGestureHandler.updateMinSize(minWidth, minHeight);
        mPipResizeGestureHandler.updateMaxSize(maxWidth, maxHeight);
        mPipBoundsState.setMaxSize(maxWidth, maxHeight);
        mPipBoundsState.setMinSize(minWidth, minHeight);
        mPipBoundsState.updateMinMaxSize(aspectRatio);
        mPipResizeGestureHandler.updateMinSize(mPipBoundsState.getMinSize().x,
                mPipBoundsState.getMinSize().y);
        mPipResizeGestureHandler.updateMaxSize(mPipBoundsState.getMaxSize().x,
                mPipBoundsState.getMaxSize().y);
    }

    /**