Attempt auto-enter-pip only on user-leaving
Abandon the path to auto-enter-pip in ActivityRecord#makeInvisible and
we should be able to rely solely on TaskFragment#startPausing
Bug: 207739601
Test: ensure regular auto-enter-pip flow works
&& follow the reproduce steps in bug
Test: atest PinnedStackTests
Change-Id: I327e7e84c511100f7a017ad55447bb7f29a763bd
This commit is contained in:
@@ -5503,19 +5503,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
"makeInvisible", true /* beforeStopping */);
|
||||
// Defer telling the client it is hidden if it can enter Pip and isn't current paused,
|
||||
// stopped or stopping. This gives it a chance to enter Pip in onPause().
|
||||
// TODO: There is still a question surrounding activities in multi-window mode that want
|
||||
// to enter Pip after they are paused, but are still visible. I they should be okay to
|
||||
// enter Pip in those cases, but not "auto-Pip" which is what this condition covers and
|
||||
// the current contract for "auto-Pip" is that the app should enter it before onPause
|
||||
// returns. Just need to confirm this reasoning makes sense.
|
||||
final boolean deferHidingClient = canEnterPictureInPicture
|
||||
&& !isState(STARTED, STOPPING, STOPPED, PAUSED);
|
||||
if (!mTransitionController.isShellTransitionsEnabled()
|
||||
&& deferHidingClient && pictureInPictureArgs.isAutoEnterEnabled()) {
|
||||
// Go ahead and just put the activity in pip if it supports auto-pip.
|
||||
mAtmService.enterPictureInPictureMode(this, pictureInPictureArgs);
|
||||
return;
|
||||
}
|
||||
setDeferHidingClient(deferHidingClient);
|
||||
setVisibility(false);
|
||||
|
||||
|
||||
@@ -1460,7 +1460,8 @@ class TaskFragment extends WindowContainer<WindowContainer> {
|
||||
// next activity.
|
||||
final boolean lastResumedCanPip = prev.checkEnterPictureInPictureState(
|
||||
"shouldAutoPipWhilePausing", userLeaving);
|
||||
if (lastResumedCanPip && prev.pictureInPictureArgs.isAutoEnterEnabled()) {
|
||||
if (userLeaving && lastResumedCanPip
|
||||
&& prev.pictureInPictureArgs.isAutoEnterEnabled()) {
|
||||
shouldAutoPip = true;
|
||||
} else if (!lastResumedCanPip) {
|
||||
// If the flag RESUME_WHILE_PAUSING is set, then continue to schedule the previous
|
||||
|
||||
Reference in New Issue
Block a user