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

Commit df339e70 authored by Mateusz Cicheński's avatar Mateusz Cicheński
Browse files

Only remove overlay reference once it is faded out

This allows to remove the overlay in case of exit transition that
comes before the overlay is faded out - in such cases the overlay
handling code would skip removal due to PipTransitionState.UNDEFINED
state set after the exit transition.

Bug: 312050085
Test: before http://recall/-/ekEuGtt9d9HWqkUtAzpHx8/cY9l8Yv2NIB1Bo30xGfnWn
Test: after http://recall/-/ekEuGtt9d9HWqkUtAzpHx8/bIau9G9vKCmm1Q9liuS5q5
Test: note that videos are taken with the fadeout delay set to 2000 ms
for easier visualization
Flag: none

Change-Id: I59fea21fd640719d507619dd7c34ca3c5445c760
parent f4604875
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -554,6 +554,11 @@ public class PipTransition extends PipTransitionController {
                }
            }
        }
        // if overlay is present remove it immediately, as exit transition came before it faded out
        if (mPipOrganizer.mSwipePipToHomeOverlay != null) {
            startTransaction.remove(mPipOrganizer.mSwipePipToHomeOverlay);
            clearSwipePipToHomeOverlay();
        }
        if (pipChange == null) {
            ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                    "%s: No window of exiting PIP is found. Can't play expand animation", TAG);
@@ -1007,7 +1012,6 @@ public class PipTransition extends PipTransitionController {
            // the overlay to the final PIP task.
            startTransaction.reparent(swipePipToHomeOverlay, leash)
                    .setLayer(swipePipToHomeOverlay, Integer.MAX_VALUE);
            mPipOrganizer.mSwipePipToHomeOverlay = null;
        }

        final Rect sourceBounds = pipTaskInfo.configuration.windowConfiguration.getBounds();
@@ -1029,7 +1033,7 @@ public class PipTransition extends PipTransitionController {
        sendOnPipTransitionFinished(TRANSITION_DIRECTION_TO_PIP);
        if (swipePipToHomeOverlay != null) {
            mPipOrganizer.fadeOutAndRemoveOverlay(swipePipToHomeOverlay,
                    null /* callback */, false /* withStartDelay */);
                    this::clearSwipePipToHomeOverlay /* callback */, false /* withStartDelay */);
        }
        mPipTransitionState.setInSwipePipToHomeTransition(false);
    }
@@ -1173,6 +1177,10 @@ public class PipTransition extends PipTransitionController {
        mPipMenuController.updateMenuBounds(destinationBounds);
    }

    private void clearSwipePipToHomeOverlay() {
        mPipOrganizer.mSwipePipToHomeOverlay = null;
    }

    @Override
    public void dump(PrintWriter pw, String prefix) {
        final String innerPrefix = prefix + "  ";