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

Commit f48b904b authored by Ben Lin's avatar Ben Lin Committed by Android (Google) Code Review
Browse files

Merge "Pass current PIP bounds to #updateReentryBounds."

parents 5ec98fb6 1ced33a4
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -454,10 +454,11 @@ public class PipTaskOrganizer extends TaskOrganizer implements

    private void sendOnPipTransitionStarted(
            @PipAnimationController.TransitionDirection int direction) {
        final Rect pipBounds = new Rect(mLastReportedBounds);
        runOnMainHandler(() -> {
            for (int i = mPipTransitionCallbacks.size() - 1; i >= 0; i--) {
                final PipTransitionCallback callback = mPipTransitionCallbacks.get(i);
                callback.onPipTransitionStarted(mTaskInfo.baseActivity, direction);
                callback.onPipTransitionStarted(mTaskInfo.baseActivity, direction, pipBounds);
            }
        });
    }
@@ -973,7 +974,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
        /**
         * Callback when the pip transition is started.
         */
        void onPipTransitionStarted(ComponentName activity, int direction);
        void onPipTransitionStarted(ComponentName activity, int direction, Rect pipBounds);

        /**
         * Callback when the pip transition is finished.
+3 −5
Original line number Diff line number Diff line
@@ -373,10 +373,10 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
    }

    @Override
    public void onPipTransitionStarted(ComponentName activity, int direction) {
    public void onPipTransitionStarted(ComponentName activity, int direction, Rect pipBounds) {
        if (isOutPipDirection(direction)) {
            // Exiting PIP, save the reentry bounds to restore to when re-entering.
            updateReentryBounds();
            updateReentryBounds(pipBounds);
            mPipBoundsHandler.onSaveReentryBounds(activity, mReentryBounds);
        }
        // Disable touches while the animation is running
@@ -393,15 +393,13 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
    /**
     * Update the bounds used to save the re-entry size and snap fraction when exiting PIP.
     */
    public void updateReentryBounds() {
    public void updateReentryBounds(Rect bounds) {
        // On phones, the expansion animation that happens on pip tap before restoring
        // to fullscreen makes it so that the last reported bounds are the expanded
        // bounds. We want to restore to the unexpanded bounds when re-entering pip,
        // so we use the bounds before expansion (normal) instead of the reported
        // bounds.
        Rect reentryBounds = mTouchHandler.getNormalBounds();
        // Apply the snap fraction of the current bounds to the normal bounds.
        final Rect bounds = mPipTaskOrganizer.getLastReportedBounds();
        float snapFraction = mPipBoundsHandler.getSnapFraction(bounds);
        mPipBoundsHandler.applySnapFraction(reentryBounds, snapFraction);
        mReentryBounds.set(reentryBounds);
+1 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
    private final PipTaskOrganizer.PipTransitionCallback mPipTransitionCallback =
            new PipTaskOrganizer.PipTransitionCallback() {
        @Override
        public void onPipTransitionStarted(ComponentName activity, int direction) {}
        public void onPipTransitionStarted(ComponentName activity, int direction, Rect pipBounds) {}

        @Override
        public void onPipTransitionFinished(ComponentName activity, int direction) {
+1 −1
Original line number Diff line number Diff line
@@ -663,7 +663,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
    };

    @Override
    public void onPipTransitionStarted(ComponentName activity, int direction) { }
    public void onPipTransitionStarted(ComponentName activity, int direction, Rect pipBounds) { }

    @Override
    public void onPipTransitionFinished(ComponentName activity, int direction) {