summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ikram Gabiyev <gabiyev@google.com> 2024-08-14 14:30:54 -0700
committer Ikram Gabiyev <gabiyev@google.com> 2024-08-14 14:57:26 -0700
commitde1edcda5d5efc257115506bd532c52ce7b47dfc (patch)
tree828ddc148a4836c32d24855a928e14593767c850
parenta914484298bedfda9d8b480c672dd3f35a4d2173 (diff)
Check if activity entering PiP is a top activity
We need to make sure we handle any trampoline activity start cases where, for instance, some Activity A, start another activity B on creation, but then, the activity A calls to enterPictureInPictureMode(). Bug: 359944953 Flag: com.android.wm.shell.enable_pip2_implementation Test: atest PinnedStackTests#testAutoEnterPictureInPictureLaunchActivity Change-Id: Ic3e7db08c8b552e2d83d6edac00035b249e3af85
-rw-r--r--services/core/java/com/android/server/wm/ActivityRecord.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 5c096ecbba04..5500229af7be 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -3292,6 +3292,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
return false;
}
+ // Check if this activity is the top activity of its task - this prevents any trampolines
+ // followed by enterPictureInPictureMode() calls by an activity from below in its stack.
+ if (getTask().getTopMostActivity() != this) {
+ return false;
+ }
+
// Check to see if PiP is supported for the display this container is on.
if (mDisplayContent != null && !mDisplayContent.mDwpcHelper.isEnteringPipAllowed(
getUid())) {