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

Commit b3aeed49 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Avoid prematurely reporting completion of split resize transition" into main

parents d353b637 5ae2c3a3
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -339,6 +339,23 @@ public class SplitDecorManager extends WindowlessWindowManager {
    /** Stops showing resizing hint. */
    public void onResized(SurfaceControl.Transaction t,
            @Nullable Consumer<Boolean> animFinishedCallback) {
        // If there is a running animation, place a placeholder callback to avoid calling the end
        // callback too early when canceling the existed animation before the new animation starts.
        final Consumer<Boolean> callbackPlaceHolder =
                animFinishedCallback != null && mRunningAnimationCount > 0 ? status -> {} : null;
        if (callbackPlaceHolder != null) {
            mRunningAnimationCount++;
            mAnimFinishCallbacks.put(callbackPlaceHolder, false);
        }
        animateResized(t, animFinishedCallback);
        if (callbackPlaceHolder != null) {
            mRunningAnimationCount--;
            updateCallbackStatus(false /* callbackStatus */, callbackPlaceHolder);
        }
    }

    private void animateResized(SurfaceControl.Transaction t,
            @Nullable Consumer<Boolean> animFinishedCallback) {
        if (mScreenshotAnimator != null && mScreenshotAnimator.isRunning()) {
            mScreenshotAnimator.cancel();
        }