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

Commit 84d2148a authored by Ben Lin's avatar Ben Lin Committed by Automerger Merge Worker
Browse files

Merge changes I3a200a5d,Ieb7054d9 into rvc-dev am: cde7161d

Change-Id: Icb4207aa767e41560cf0b0443267bd9b8e2e0112
parents 20ca4abf cde7161d
Loading
Loading
Loading
Loading
+3 −16
Original line number Diff line number Diff line
@@ -61,12 +61,6 @@ public class PipBoundsHandler {
    private final DisplayInfo mDisplayInfo = new DisplayInfo();
    private final Rect mTmpInsets = new Rect();

    /**
     * Tracks the destination bounds, used for any following
     * {@link #onMovementBoundsChanged(Rect, Rect, Rect, DisplayInfo)} calculations.
     */
    private final Rect mLastDestinationBounds = new Rect();

    private ComponentName mLastPipComponentName;
    private float mReentrySnapFraction = INVALID_SNAP_FRACTION;
    private Size mReentrySize;
@@ -198,11 +192,6 @@ public class PipBoundsHandler {
        mReentrySnapFraction = INVALID_SNAP_FRACTION;
        mReentrySize = null;
        mLastPipComponentName = null;
        mLastDestinationBounds.setEmpty();
    }

    public Rect getLastDestinationBounds() {
        return mLastDestinationBounds;
    }

    public Rect getDisplayBounds() {
@@ -262,7 +251,6 @@ public class PipBoundsHandler {
                    false /* useCurrentMinEdgeSize */);
        }
        mAspectRatio = aspectRatio;
        mLastDestinationBounds.set(destinationBounds);
        return destinationBounds;
    }

@@ -276,8 +264,8 @@ public class PipBoundsHandler {
     *
     * @return {@code true} if internal {@link DisplayInfo} is rotated, {@code false} otherwise.
     */
    public boolean onDisplayRotationChanged(Rect outBounds, int displayId, int fromRotation,
            int toRotation, WindowContainerTransaction t) {
    public boolean onDisplayRotationChanged(Rect outBounds, Rect oldBounds, int displayId,
            int fromRotation, int toRotation, WindowContainerTransaction t) {
        // Bail early if the event is not sent to current {@link #mDisplayInfo}
        if ((displayId != mDisplayInfo.displayId) || (fromRotation == toRotation)) {
            return false;
@@ -295,7 +283,7 @@ public class PipBoundsHandler {
        }

        // Calculate the snap fraction of the current stack along the old movement bounds
        final Rect postChangeStackBounds = new Rect(mLastDestinationBounds);
        final Rect postChangeStackBounds = new Rect(oldBounds);
        final float snapFraction = getSnapFraction(postChangeStackBounds);

        // Populate the new {@link #mDisplayInfo}.
@@ -313,7 +301,6 @@ public class PipBoundsHandler {
                snapFraction);

        outBounds.set(postChangeStackBounds);
        mLastDestinationBounds.set(outBounds);
        t.setBounds(pinnedStackInfo.stackToken, outBounds);
        return true;
    }
+1 −0
Original line number Diff line number Diff line
@@ -600,6 +600,7 @@ public class PipTaskOrganizer extends TaskOrganizer {
            Log.w(TAG, "Abort animation, invalid leash");
            return;
        }
        mLastReportedBounds.set(destinationBounds);
        final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction();
        mSurfaceTransactionHelper
                .crop(tx, mLeash, destinationBounds)
+2 −2
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
    private final DisplayChangeController.OnDisplayChangingListener mRotationController = (
            int displayId, int fromRotation, int toRotation, WindowContainerTransaction t) -> {
        final boolean changed = mPipBoundsHandler.onDisplayRotationChanged(mTmpNormalBounds,
                displayId, fromRotation, toRotation, t);
                mPipTaskOrganizer.getLastReportedBounds(), displayId, fromRotation, toRotation, t);
        if (changed) {
            updateMovementBounds(mTmpNormalBounds, true /* fromRotation */,
                    false /* fromImeAdjustment */, false /* fromShelfAdjustment */);
@@ -293,7 +293,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
            final boolean changed = mPipBoundsHandler.setShelfHeight(visible, height);
            if (changed) {
                mTouchHandler.onShelfVisibilityChanged(visible, height);
                updateMovementBounds(mPipBoundsHandler.getLastDestinationBounds(),
                updateMovementBounds(mPipTaskOrganizer.getLastReportedBounds(),
                        false /* fromRotation */, false /* fromImeAdjustment */,
                        true /* fromShelfAdjustment */);
            }
+1 −1
Original line number Diff line number Diff line
@@ -424,7 +424,7 @@ public class PipTouchHandler {

        // If this is from an IME or shelf adjustment, then we should move the PiP so that it is not
        // occluded by the IME or shelf.
        if (fromImeAdjustment || fromShelfAdjustment || fromDisplayRotationChanged) {
        if (fromImeAdjustment || fromShelfAdjustment) {
            if (mTouchState.isUserInteracting()) {
                // Defer the update of the current movement bounds until after the user finishes
                // touching the screen