From 889b10e092319609846450d2ffb5772fbc73d727 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Fri, 9 Jun 2023 23:16:25 +0800 Subject: Use TYPE_ENTER_PIP_FROM_SPLIT only if the task is on split Otherwise even if the split pair is in background, any standalone entering PiP will always use TYPE_ENTER_PIP_FROM_SPLIT. That may either disturb split state or notify some unexpected transition handlers to run additional animation. Bug: 286363453 Test: 1. Return to home from a split pair, the activity on the split can enter PiP successfully. 2. Put a split pair in background, launch another fullscreen activity and request entering PiP, the log should not show: "Got a PiP-enter request while Split-Screen is active". Change-Id: I780d0bd22ba5e3992ad859e6f770033c1b4d6487 --- .../src/com/android/wm/shell/transition/DefaultMixedHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java index 3ec433e55da9..4f9bcaa53e8c 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java @@ -24,6 +24,7 @@ import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.window.TransitionInfo.FLAG_IS_WALLPAPER; import static com.android.wm.shell.common.split.SplitScreenConstants.FLAG_IS_DIVIDER_BAR; +import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_UNDEFINED; import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_UNDEFINED; import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_CHILD_TASK_ENTER_PIP; import static com.android.wm.shell.util.TransitionUtil.isOpeningType; @@ -158,7 +159,9 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler, @Override public WindowContainerTransaction handleRequest(@NonNull IBinder transition, @NonNull TransitionRequestInfo request) { - if (mPipHandler.requestHasPipEnter(request) && mSplitHandler.isSplitActive()) { + if (mPipHandler.requestHasPipEnter(request) && mSplitHandler.isSplitActive() + && request.getTriggerTask() != null && mSplitHandler.getSplitItemPosition( + request.getTriggerTask().token) != SPLIT_POSITION_UNDEFINED) { ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Got a PiP-enter request while " + "Split-Screen is active, so treat it as Mixed."); if (request.getRemoteTransition() != null) { -- cgit v1.2.3-59-g8ed1b