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

Commit 5fe72398 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Set correct PiP bounds and user resize bounds when the display changes" into main

parents 912ecb07 1a5b09e4
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -341,7 +341,6 @@ public class PipController implements ConfigurationChangeListener,
            return;
            return;
        }
        }
        final float snapFraction = mPipBoundsAlgorithm.getSnapFraction(mPipBoundsState.getBounds());
        final float snapFraction = mPipBoundsAlgorithm.getSnapFraction(mPipBoundsState.getBounds());
        final float boundsScale = mPipBoundsState.getBoundsScale();


        // Update the display layout caches even if we are not in PiP.
        // Update the display layout caches even if we are not in PiP.
        setDisplayLayout(mDisplayController.getDisplayLayout(displayId));
        setDisplayLayout(mDisplayController.getDisplayLayout(displayId));
@@ -368,6 +367,10 @@ public class PipController implements ConfigurationChangeListener,
            mPipTouchHandler.updateMovementBounds();
            mPipTouchHandler.updateMovementBounds();
            mPipTransitionState.setInFixedRotation(false);
            mPipTransitionState.setInFixedRotation(false);
        } else {
        } else {
            final float boundsScale = mPipBoundsState.getBoundsScale();
            // Before calculating the PiP bounds, the PiP minimum and maximum sizes
            // need to be recalculated for the current display.
            mPipBoundsState.updateMinMaxSize(mPipBoundsState.getAspectRatio());
            Rect toBounds = new Rect(0, 0,
            Rect toBounds = new Rect(0, 0,
                    (int) Math.ceil(mPipBoundsState.getMaxSize().x * boundsScale),
                    (int) Math.ceil(mPipBoundsState.getMaxSize().x * boundsScale),
                    (int) Math.ceil(mPipBoundsState.getMaxSize().y * boundsScale));
                    (int) Math.ceil(mPipBoundsState.getMaxSize().y * boundsScale));
@@ -378,6 +381,7 @@ public class PipController implements ConfigurationChangeListener,
            // The policy is to keep PiP snap fraction invariant.
            // The policy is to keep PiP snap fraction invariant.
            mPipBoundsAlgorithm.applySnapFraction(toBounds, snapFraction);
            mPipBoundsAlgorithm.applySnapFraction(toBounds, snapFraction);
            mPipBoundsState.setBounds(toBounds);
            mPipBoundsState.setBounds(toBounds);
            mPipTouchHandler.setUserResizeBounds(toBounds);
        }
        }
        if (mPipTransitionState.getPipTaskToken() == null) {
        if (mPipTransitionState.getPipTaskToken() == null) {
            Log.d(TAG, "PipController.onDisplayChange no PiP task token"
            Log.d(TAG, "PipController.onDisplayChange no PiP task token"