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

Commit 79aae3c0 authored by jorgegil@google.com's avatar jorgegil@google.com
Browse files

Allow finish resize transaction to be overriden

Allows vendors to modify the window container transaction
when finishing a bounds resize.

Bug: 159147615
Test: atest SystemUITests
Change-Id: Ibacaafb7ca2f79864997d3a43c372cf1814c8e3c
parent 8808b5a3
Loading
Loading
Loading
Loading
+24 −3
Original line number Diff line number Diff line
@@ -738,9 +738,9 @@ public class PipTaskOrganizer extends TaskOrganizer implements
            // on the task to ensure that the task "matches" the parent's bounds.
            taskBounds = (direction == TRANSITION_DIRECTION_TO_FULLSCREEN)
                    ? null : destinationBounds;
            // As for the final windowing mode, simply reset it to undefined and reset the activity
            // mode set prior to the animation running
            wct.setWindowingMode(mToken, WINDOWING_MODE_UNDEFINED);
            // Reset the final windowing mode.
            wct.setWindowingMode(mToken, getOutPipWindowingMode());
            // Simply reset the activity mode set prior to the animation running.
            wct.setActivityWindowingMode(mToken, WINDOWING_MODE_UNDEFINED);
            if (mSplitDivider != null && direction == TRANSITION_DIRECTION_TO_SPLIT_SCREEN) {
                wct.reparent(mToken, mSplitDivider.getSecondaryRoot(), true /* onTop */);
@@ -752,9 +752,30 @@ public class PipTaskOrganizer extends TaskOrganizer implements

        wct.setBounds(mToken, taskBounds);
        wct.setBoundsChangeTransaction(mToken, tx);
        applyFinishBoundsResize(wct, direction);
    }

    /**
     * Applies the window container transaction to finish a bounds resize.
     *
     * Called by {@link #finishResize(SurfaceControl.Transaction, Rect, int, int)}} once it has
     * finished preparing the transaction. It allows subclasses to modify the transaction before
     * applying it.
     */
    public void applyFinishBoundsResize(@NonNull WindowContainerTransaction wct,
            @PipAnimationController.TransitionDirection int direction) {
        WindowOrganizer.applyTransaction(wct);
    }

    /**
     * The windowing mode to restore to when resizing out of PIP direction. Defaults to undefined
     * and can be overridden to restore to an alternate windowing mode.
     */
    public int getOutPipWindowingMode() {
        // By default, simply reset the windowing mode to undefined.
        return WINDOWING_MODE_UNDEFINED;
    }

    private void animateResizePip(Rect currentBounds, Rect destinationBounds,
            @PipAnimationController.TransitionDirection int direction, int durationMs) {
        if (Looper.myLooper() != mUpdateHandler.getLooper()) {