From 34cf703bdb6721ae35bd3472200a12a1a4910705 Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Tue, 20 Jun 2023 16:54:25 -0700 Subject: [PATCH] Also check PiP activity visibility to determine if enter-pip Originally assumed that we could detect "commit to transient-launch" by the transient-launch task being visible at transition end; however, because we can't defer activity launches, if an activity launches after recents finishes, but before its finishTransition runs, the launcher may actually be visREquested=false and we'd then skip entering pip. Resolve this by also checking if the pip app became invisible during the transient-launch. This way, if either is true, we'll enter pip. Bug: 286729035 Test: swipe maps navigation to pip and, before anim finishes, launch an app. Change-Id: Ib4a1a199093f3266148ace0443eb800f69606cef --- services/core/java/com/android/server/wm/Transition.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index 3d9edcac8eb10..5f2d3ca8175b8 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -979,7 +979,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } if (ar.pictureInPictureArgs != null && ar.pictureInPictureArgs.isAutoEnterEnabled()) { - if (didCommitTransientLaunch()) { + if (!ar.getTask().isVisibleRequested() || didCommitTransientLaunch()) { // force enable pip-on-task-switch now that we've committed to actually launching // to the transient activity. ar.supportsEnterPipOnTaskSwitch = true; @@ -1008,7 +1008,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } // Legacy pip-entry (not via isAutoEnterEnabled). - if (didCommitTransientLaunch() && ar.supportsPictureInPicture()) { + if ((!ar.getTask().isVisibleRequested() || didCommitTransientLaunch()) + && ar.supportsPictureInPicture()) { // force enable pip-on-task-switch now that we've committed to actually launching to the // transient activity, and then recalculate whether we can attempt pip. ar.supportsEnterPipOnTaskSwitch = true;