Merge "Skip finishing menu activity when dismissing PiP" into pi-dev

This commit is contained in:
Winson Chung
2018-06-07 00:35:54 +00:00
committed by Android (Google) Code Review

View File

@@ -342,7 +342,7 @@ public class PipMenuActivity extends Activity {
mHandler.post(() -> { mHandler.post(() -> {
event.getAnimationTrigger().decrement(); event.getAnimationTrigger().decrement();
}); });
}, true /* notifyMenuVisibility */); }, true /* notifyMenuVisibility */, false /* isDismissing */);
} }
} }
@@ -396,10 +396,12 @@ public class PipMenuActivity extends Activity {
} }
private void hideMenu() { 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) { if (mMenuState != MENU_STATE_NONE) {
cancelDelayedFinish(); cancelDelayedFinish();
if (notifyMenuVisibility) { if (notifyMenuVisibility) {
@@ -422,7 +424,12 @@ public class PipMenuActivity extends Activity {
if (animationFinishedRunnable != null) { if (animationFinishedRunnable != null) {
animationFinishedRunnable.run(); 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(); mMenuContainerAnimator.start();
@@ -583,7 +590,7 @@ public class PipMenuActivity extends Activity {
hideMenu(() -> { hideMenu(() -> {
sendEmptyMessage(PipMenuActivityController.MESSAGE_EXPAND_PIP, sendEmptyMessage(PipMenuActivityController.MESSAGE_EXPAND_PIP,
"Could not notify controller to expand PIP"); "Could not notify controller to expand PIP");
}, false /* notifyMenuVisibility */); }, false /* notifyMenuVisibility */, false /* isDismissing */);
} }
private void minimizePip() { private void minimizePip() {
@@ -597,7 +604,7 @@ public class PipMenuActivity extends Activity {
hideMenu(() -> { hideMenu(() -> {
sendEmptyMessage(PipMenuActivityController.MESSAGE_DISMISS_PIP, sendEmptyMessage(PipMenuActivityController.MESSAGE_DISMISS_PIP,
"Could not notify controller to dismiss PIP"); "Could not notify controller to dismiss PIP");
}, false /* notifyMenuVisibility */); }, false /* notifyMenuVisibility */, true /* isDismissing */);
} }
private void showPipMenu() { private void showPipMenu() {