Don't try to auto-pip if there's already a pip

Was mistakenly not checking. Legacy just forbid this, so
do the same with shell.

Also, move when we reset track-count in wmcore. This is
not really consequential, but without it the logs are
a little less clear.

Bug: 280227595
Test: Swipe-to-home an auto-pip app while there is already
      a pip.
Change-Id: I95204309614bac523abdf9787ad668026d5d0401
This commit is contained in:
Evan Rosky
2023-05-01 12:27:38 -07:00
parent ba26bf97c5
commit 22b480c3aa
2 changed files with 13 additions and 3 deletions

View File

@@ -954,6 +954,13 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
// to the transient activity.
ar.supportsEnterPipOnTaskSwitch = true;
}
// Make sure this activity can enter pip under the current circumstances.
// `enterPictureInPicture` internally checks, but with beforeStopping=false which
// is specifically for non-auto-enter.
if (!ar.checkEnterPictureInPictureState("enterPictureInPictureMode",
true /* beforeStopping */)) {
return false;
}
return mController.mAtm.enterPictureInPictureMode(ar, ar.pictureInPictureArgs,
false /* fromClient */);
}

View File

@@ -813,6 +813,10 @@ class TransitionController {
}
ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS, "Finish Transition: %s", record);
mPlayingTransitions.remove(record);
if (!inTransition()) {
// reset track-count now since shell-side is idle.
mTrackCount = 0;
}
updateRunningRemoteAnimation(record, false /* isPlaying */);
record.finishTransition();
for (int i = mAnimatingExitWindows.size() - 1; i >= 0; i--) {
@@ -825,10 +829,9 @@ class TransitionController {
}
}
mRunningLock.doNotifyLocked();
// Run state-validation checks when no transitions are active anymore.
// Run state-validation checks when no transitions are active anymore (Note: sometimes
// finish can start a transition, so check afterwards -- eg. pip).
if (!inTransition()) {
// Can reset track-count now that everything is idle.
mTrackCount = 0;
validateStates();
mAtm.mWindowManager.onAnimationFinished();
}