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

Commit 94ee6735 authored by Vania Desmonda's avatar Vania Desmonda Committed by Android (Google) Code Review
Browse files

Merge "Rename `TRANSIT_RESIZE_PIP` to `TRANSIT_PIP_BOUNDS_CHANGE`." into main

parents eacc08e2 6c01ae35
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -156,11 +156,11 @@ public abstract class PipTransitionController implements Transitions.TransitionH
    }

    /**
     * Called when the Shell wants to start resizing Pip transition/animation.
     * Called when the Shell wants to start changing the Pip bounds transition/animation.
     *
     * @param duration the suggested duration for resize animation.
     * @param duration the suggested duration for bounds change animation.
     */
    public void startResizeTransition(WindowContainerTransaction wct, int duration) {
    public void startPipBoundsChangeTransition(WindowContainerTransaction wct, int duration) {
        // Default implementation does nothing.
    }

+1 −1
Original line number Diff line number Diff line
@@ -86,6 +86,6 @@ public class PipDisplayTransferHandler implements
        if (startTx == null) return;

        startTx.apply();
        mPipScheduler.scheduleFinishResizePip(destinationBounds);
        mPipScheduler.scheduleFinishPipBoundsChange(destinationBounds);
    }
}
+5 −5
Original line number Diff line number Diff line
@@ -52,11 +52,11 @@ import com.android.wm.shell.protolog.ShellProtoLogGroup;
import com.android.wm.shell.shared.animation.PhysicsAnimator;
import com.android.wm.shell.shared.magnetictarget.MagnetizedObject;

import java.util.Optional;

import kotlin.Unit;
import kotlin.jvm.functions.Function0;

import java.util.Optional;

/**
 * A helper to animate and manipulate the PiP.
 */
@@ -810,7 +810,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
        cleanUpHighPerfSessionMaybe();

        // Signal that the transition is done - should update transition state by default.
        mPipScheduler.scheduleFinishResizePip(destinationBounds);
        mPipScheduler.scheduleFinishPipBoundsChange(destinationBounds);
    }

    private void startResizeAnimation(SurfaceControl.Transaction startTx,
@@ -830,8 +830,8 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
            settlePipBoundsAfterPhysicsAnimation(false /* animatingAfter */);

            cleanUpHighPerfSessionMaybe();
            // Signal that we are done with resize transition
            mPipScheduler.scheduleFinishResizePip(destinationBounds);
            // Signal that we are done with bounds change transition
            mPipScheduler.scheduleFinishPipBoundsChange(destinationBounds);
        });
        animator.start();
    }
+2 −2
Original line number Diff line number Diff line
@@ -530,8 +530,8 @@ public class PipResizeGestureHandler implements
                    resetState();
                    cleanUpHighPerfSessionMaybe();

                    // Signal that we are done with resize transition
                    mPipScheduler.scheduleFinishResizePip(destinationBounds);
                    // Signal that we are done with bounds change transition
                    mPipScheduler.scheduleFinishPipBoundsChange(destinationBounds);
                });
                animator.start();
                break;
+6 −6
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ public class PipScheduler implements PipTransitionState.PipTransitionStateChange
            }
        }
        wct.setBounds(pipTaskToken, toBounds);
        mPipTransitionController.startResizeTransition(wct, duration);
        mPipTransitionController.startPipBoundsChangeTransition(wct, duration);
    }

    /**
@@ -230,19 +230,19 @@ public class PipScheduler implements PipTransitionState.PipTransitionStateChange
        Rect newSampleBounds = new Rect(0, 0, (int) newWidth, (int) newHeight);
        wct.setBounds(pipTaskToken, newSampleBounds);

        mPipTransitionController.startResizeTransition(wct, DISPLAY_TRANSFER_DURATION_MS);
        mPipTransitionController.startPipBoundsChangeTransition(wct, DISPLAY_TRANSFER_DURATION_MS);
    }

    /**
     * Signals to Core to finish the PiP resize transition.
     * Signals to Core to finish the PiP bounds change transition.
     * Note that we do not allow any actual WM Core changes at this point.
     *
     * @param toBounds destination bounds used only for internal state updates - not sent to Core.
     */
    public void scheduleFinishResizePip(Rect toBounds) {
    public void scheduleFinishPipBoundsChange(Rect toBounds) {
        // Make updates to the internal state to reflect new bounds before updating any transitions
        // related state; transition state updates can trigger callbacks that use the cached bounds.
        onFinishingPipResize(toBounds);
        onFinishingPipBoundsChange(toBounds);
        mPipTransitionController.finishTransition();
    }

@@ -309,7 +309,7 @@ public class PipScheduler implements PipTransitionState.PipTransitionStateChange
        }
    }

    private void onFinishingPipResize(Rect newBounds) {
    private void onFinishingPipBoundsChange(Rect newBounds) {
        if (mPipBoundsState.getBounds().equals(newBounds)) {
            return;
        }
Loading