Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0643ee3 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

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
parent 0a35c847
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -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;
            }