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

Commit 99396aa6 authored by Hongwei Wang's avatar Hongwei Wang Committed by Automerger Merge Worker
Browse files

Merge "Adjust PiP source rect hint for window bounds" into tm-qpr-dev am: 4805fa7d am: c47f1d7a

parents 15400455 c47f1d7a
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1159,7 +1159,6 @@ public class ActivityOptions extends ComponentOptions {
        opts.mLaunchIntoPipParams = new PictureInPictureParams.Builder(pictureInPictureParams)
                .setIsLaunchIntoPip(true)
                .build();
        opts.mLaunchBounds = new Rect(pictureInPictureParams.getSourceRectHint());
        return opts;
    }

+16 −0
Original line number Diff line number Diff line
@@ -1993,6 +1993,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

            if (options.getLaunchIntoPipParams() != null) {
                pictureInPictureArgs = options.getLaunchIntoPipParams();
                if (sourceRecord != null) {
                    adjustPictureInPictureParamsIfNeeded(sourceRecord.getBounds());
                }
            }

            mOverrideTaskTransition = options.getOverrideTaskTransition();
@@ -9763,6 +9766,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    void setPictureInPictureParams(PictureInPictureParams p) {
        pictureInPictureArgs.copyOnlySet(p);
        adjustPictureInPictureParamsIfNeeded(getBounds());
        getTask().getRootTask().onPictureInPictureParamsChanged();
    }

@@ -9809,6 +9813,18 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        return new Point(windowLayout.minWidth, windowLayout.minHeight);
    }

    /**
     * Adjust the source rect hint in {@link #pictureInPictureArgs} by window bounds since
     * it is relative to its root view (see also b/235599028).
     * It is caller's responsibility to make sure this is called exactly once when we update
     * {@link #pictureInPictureArgs} to avoid double offset.
     */
    private void adjustPictureInPictureParamsIfNeeded(Rect windowBounds) {
        if (pictureInPictureArgs != null && pictureInPictureArgs.hasSourceBoundsHint()) {
            pictureInPictureArgs.getSourceRectHint().offset(windowBounds.left, windowBounds.top);
        }
    }

    static class Builder {
        private final ActivityTaskManagerService mAtmService;
        private WindowProcessController mCallerApp;
+1 −1
Original line number Diff line number Diff line
@@ -2116,7 +2116,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                // entering content-pip animation.
                mWindowManager.mTaskSnapshotController.recordTaskSnapshot(
                        task, false /* allowSnapshotHome */);
                rootTask.setBounds(r.getOptions().getLaunchBounds());
                rootTask.setBounds(r.pictureInPictureArgs.getSourceRectHint());
            }
            rootTask.setDeferTaskAppear(false);