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

Commit 79d4b988 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Invalidate resized bounds on aspect ratio changes" into rvc-qpr-dev am: 3c74b1fa

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12395565

Change-Id: I0be30ca70a805b310a1a17188631b4e6a3916f0d
parents 04ddd768 3c74b1fa
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -230,7 +230,10 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio

        @Override
        public void onAspectRatioChanged(float aspectRatio) {
            mHandler.post(() -> mPipBoundsHandler.onAspectRatioChanged(aspectRatio));
            mHandler.post(() -> {
                mPipBoundsHandler.onAspectRatioChanged(aspectRatio);
                mTouchHandler.onAspectRatioChanged();
            });
        }
    }

+4 −0
Original line number Diff line number Diff line
@@ -364,6 +364,10 @@ public class PipResizeGestureHandler {
        mUserResizeBounds.set(bounds);
    }

    void invalidateUserResizeBounds() {
        mUserResizeBounds.setEmpty();
    }

    Rect getUserResizeBounds() {
        return mUserResizeBounds;
    }
+13 −0
Original line number Diff line number Diff line
@@ -422,8 +422,21 @@ public class PipTouchHandler {
        }
    }

    /**
     * Responds to IPinnedStackListener on resetting aspect ratio for the pinned window.
     */
    public void onAspectRatioChanged() {
        mPipResizeGestureHandler.invalidateUserResizeBounds();
    }

    public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds, Rect curBounds,
            boolean fromImeAdjustment, boolean fromShelfAdjustment, int displayRotation) {
        // Set the user resized bounds equal to the new normal bounds in case they were
        // invalidated (e.g. by an aspect ratio change).
        if (mPipResizeGestureHandler.getUserResizeBounds().isEmpty()) {
            mPipResizeGestureHandler.setUserResizeBounds(normalBounds);
        }

        final int bottomOffset = mIsImeShowing ? mImeHeight : 0;
        final boolean fromDisplayRotationChanged = (mDisplayRotation != displayRotation);
        if (fromDisplayRotationChanged) {