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

Commit 21004d51 authored by Winson Chung's avatar Winson Chung
Browse files

Skip finishing menu activity when dismissing PiP

- The finishing activity triggers a race in which the next layout may
  relayout the PiP window in fullscreen. As a workaround, this just
  skips finishing the menu activity, which also reverts to the O dismiss
  animation (as in there is none).

Bug: 77730018
Test: Open PiP, dismiss it
Change-Id: I9c9ccf69e50fac516339bf497cfed4bf6dc26467
parent c1203d6a
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -342,7 +342,7 @@ public class PipMenuActivity extends Activity {
                mHandler.post(() -> {
                    event.getAnimationTrigger().decrement();
                });
            }, true /* notifyMenuVisibility */);
            }, true /* notifyMenuVisibility */, false /* isDismissing */);
        }
    }

@@ -396,10 +396,12 @@ public class PipMenuActivity extends Activity {
    }

    private void hideMenu() {
        hideMenu(null /* animationFinishedRunnable */, true /* notifyMenuVisibility */);
        hideMenu(null /* animationFinishedRunnable */, true /* notifyMenuVisibility */,
                false /* isDismissing */);
    }

    private void hideMenu(final Runnable animationFinishedRunnable, boolean notifyMenuVisibility) {
    private void hideMenu(final Runnable animationFinishedRunnable, boolean notifyMenuVisibility,
            boolean isDismissing) {
        if (mMenuState != MENU_STATE_NONE) {
            cancelDelayedFinish();
            if (notifyMenuVisibility) {
@@ -422,8 +424,13 @@ public class PipMenuActivity extends Activity {
                    if (animationFinishedRunnable != null) {
                        animationFinishedRunnable.run();
                    }

                    if (!isDismissing) {
                        // If we are dismissing the PiP, then don't try to pre-emptively finish the
                        // menu activity
                        finish();
                    }
                }
            });
            mMenuContainerAnimator.start();
        } else {
@@ -583,7 +590,7 @@ public class PipMenuActivity extends Activity {
        hideMenu(() -> {
            sendEmptyMessage(PipMenuActivityController.MESSAGE_EXPAND_PIP,
                    "Could not notify controller to expand PIP");
        }, false /* notifyMenuVisibility */);
        }, false /* notifyMenuVisibility */, false /* isDismissing */);
    }

    private void minimizePip() {
@@ -597,7 +604,7 @@ public class PipMenuActivity extends Activity {
        hideMenu(() -> {
            sendEmptyMessage(PipMenuActivityController.MESSAGE_DISMISS_PIP,
                    "Could not notify controller to dismiss PIP");
        }, false /* notifyMenuVisibility */);
        }, false /* notifyMenuVisibility */, true /* isDismissing */);
    }

    private void showPipMenu() {