Merge "Do not auto-pip on launching translucent activity" into tm-qpr-dev

This commit is contained in:
Hongwei Wang
2022-09-15 17:02:18 +00:00
committed by Android (Google) Code Review

View File

@@ -1595,12 +1595,14 @@ class TaskFragment extends WindowContainer<WindowContainer> {
boolean pauseImmediately = false; boolean pauseImmediately = false;
boolean shouldAutoPip = false; boolean shouldAutoPip = false;
if (resuming != null) { if (resuming != null) {
// We do not want to trigger auto-PiP upon launch of a translucent activity.
final boolean resumingOccludesParent = resuming.occludesParent();
// Resuming the new resume activity only if the previous activity can't go into Pip // Resuming the new resume activity only if the previous activity can't go into Pip
// since we want to give Pip activities a chance to enter Pip before resuming the // since we want to give Pip activities a chance to enter Pip before resuming the
// next activity. // next activity.
final boolean lastResumedCanPip = prev.checkEnterPictureInPictureState( final boolean lastResumedCanPip = prev.checkEnterPictureInPictureState(
"shouldAutoPipWhilePausing", userLeaving); "shouldAutoPipWhilePausing", userLeaving);
if (userLeaving && lastResumedCanPip if (userLeaving && resumingOccludesParent && lastResumedCanPip
&& prev.pictureInPictureArgs.isAutoEnterEnabled()) { && prev.pictureInPictureArgs.isAutoEnterEnabled()) {
shouldAutoPip = true; shouldAutoPip = true;
} else if (!lastResumedCanPip) { } else if (!lastResumedCanPip) {