Disallow enter PiP when starting a split task
Disallow enter PiP while Launching another task
into one of split stage tasks.
This should also help Core keep
ActivityTaskSupervisor#mUserLeaving as false,
which helps avoid onUserLeaveHint() on client-side
and any legacy enter-PiP requests.
Bug: 336477473
Test: repro the steps in the bug (latest comments)
Change-Id: Idceebc9742f45d17ebe5398df2c151085d33c775
Merged-In: Idceebc9742f45d17ebe5398df2c151085d33c775
(cherry picked from commit c46fae34ddcdcb802307a91b6910e0fca5b0a449)
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java
index c85da52..3b29058 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java
@@ -1871,8 +1871,14 @@
}
// Put BAL flags to avoid activity start aborted. Otherwise, flows like shortcut to split
// will be canceled.
+ ActivityOptions options = ActivityOptions.fromBundle(opts);
opts.putBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED, true);
opts.putBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION, true);
+
+ // TODO (b/336477473): Disallow enter PiP when launching a task in split by default;
+ // this might have to be changed as more split-to-pip cujs are defined.
+ options.setDisallowEnterPictureInPictureWhileLaunching(true);
+ opts.putAll(options.toBundle());
}
void updateActivityOptions(Bundle opts, @SplitPosition int position) {