diff options
| author | 2024-09-16 18:58:51 -0700 | |
|---|---|---|
| committer | 2024-09-16 18:58:51 -0700 | |
| commit | c0643ee313bb7614e97ea4b77e27060036d83dcc (patch) | |
| tree | 9d5d4547b45a894dc4c4720b07b2c4a3b89f4f9c | |
| parent | 0a35c847cf271a772c1d07925c59d1cbc6792abf (diff) | |
Break split when entering pip if transition contains closing changes
* Previously we assumed if we were in split and a pip change was present
that we want to remain in split. That led to us calling setEnterTransition()
but then never cleaned it up because it wasn't a real enter, which prevented
future split screen enter attempts
* Now if any of the changes contains a closing task for one of the split stages,
we'll assume split is breaking
Fixes: 354653447
Flag: EXEMPT bugfix
Test: Bug no longer repros, also tested original bug when this was entered
where YouTube is in split and we share the video to Gmail, which should
enter Pip and also preseve the split
Change-Id: I719063b1b4092d24b8496107f88ea42f3a043405
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java | 17 |
1 files changed, 14 insertions, 3 deletions
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 1b143ebddde7..041533f6f02d 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 @@ -2458,6 +2458,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, final StageChangeRecord record = new StageChangeRecord(); final int transitType = info.getType(); TransitionInfo.Change pipChange = null; + int closingSplitTaskId = -1; for (int iC = 0; iC < info.getChanges().size(); ++iC) { final TransitionInfo.Change change = info.getChanges().get(iC); if (change.getMode() == TRANSIT_CHANGE @@ -2518,21 +2519,31 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, + " with " + taskInfo.taskId + " before startAnimation()."); } } + if (isClosingType(change.getMode()) && + getStageOfTask(change.getTaskInfo().taskId) != STAGE_TYPE_UNDEFINED) { + // If either one of the 2 stages is closing we're assuming we'll break split + closingSplitTaskId = change.getTaskInfo().taskId; + } } if (pipChange != null) { TransitionInfo.Change pipReplacingChange = getPipReplacingChange(info, pipChange, mMainStage.mRootTaskInfo.taskId, mSideStage.mRootTaskInfo.taskId, getSplitItemStage(pipChange.getLastParent())); - if (pipReplacingChange != null) { + boolean keepSplitWithPip = pipReplacingChange != null && closingSplitTaskId == -1; + if (keepSplitWithPip) { // Set an enter transition for when startAnimation gets called again mSplitTransitions.setEnterTransition(transition, /*remoteTransition*/ null, TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE, /*resizeAnim*/ false); + } else { + int finalClosingTaskId = closingSplitTaskId; + mRecentTasks.ifPresent(recentTasks -> + recentTasks.removeSplitPair(finalClosingTaskId)); + logExit(EXIT_REASON_FULLSCREEN_REQUEST); } mMixedHandler.animatePendingEnterPipFromSplit(transition, info, - startTransaction, finishTransaction, finishCallback, - pipReplacingChange != null); + startTransaction, finishTransaction, finishCallback, keepSplitWithPip); notifySplitAnimationFinished(); return true; } |