Merge "Skip finishing menu activity when dismissing PiP" into pi-dev
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
index a4927b7..615b29f 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
@@ -342,7 +342,7 @@
mHandler.post(() -> {
event.getAnimationTrigger().decrement();
});
- }, true /* notifyMenuVisibility */);
+ }, true /* notifyMenuVisibility */, false /* isDismissing */);
}
}
@@ -396,10 +396,12 @@
}
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,7 +424,12 @@
if (animationFinishedRunnable != null) {
animationFinishedRunnable.run();
}
- finish();
+
+ if (!isDismissing) {
+ // If we are dismissing the PiP, then don't try to pre-emptively finish the
+ // menu activity
+ finish();
+ }
}
});
mMenuContainerAnimator.start();
@@ -583,7 +590,7 @@
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 @@
hideMenu(() -> {
sendEmptyMessage(PipMenuActivityController.MESSAGE_DISMISS_PIP,
"Could not notify controller to dismiss PIP");
- }, false /* notifyMenuVisibility */);
+ }, false /* notifyMenuVisibility */, true /* isDismissing */);
}
private void showPipMenu() {