Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +27 −2 Original line number Original line Diff line number Diff line Loading @@ -2761,6 +2761,14 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, // cases above and it is not already visible // cases above and it is not already visible return null; return null; } else { } else { if (triggerTask.parentTaskId == mMainStage.mRootTaskInfo.taskId || triggerTask.parentTaskId == mSideStage.mRootTaskInfo.taskId) { ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "handleRequest: transition=%d " + "restoring to split", request.getDebugId()); out = new WindowContainerTransaction(); mSplitTransitions.setEnterTransition(transition, request.getRemoteTransition(), TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE, false /* resizeAnim */); } if (isOpening && getStageOfTask(triggerTask) != null) { if (isOpening && getStageOfTask(triggerTask) != null) { ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "handleRequest: transition=%d enter split", ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "handleRequest: transition=%d enter split", request.getDebugId()); request.getDebugId()); Loading Loading @@ -3107,7 +3115,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, // Includes TRANSIT_CHANGE to cover reparenting top-most task to split. // Includes TRANSIT_CHANGE to cover reparenting top-most task to split. mainChild = change; mainChild = change; } else if (sideChild == null && stageType == STAGE_TYPE_SIDE } else if (sideChild == null && stageType == STAGE_TYPE_SIDE && isOpeningType(change.getMode())) { && (isOpeningType(change.getMode()) || change.getMode() == TRANSIT_CHANGE)) { sideChild = change; sideChild = change; } else if (stageType != STAGE_TYPE_UNDEFINED && change.getMode() == TRANSIT_TO_BACK) { } else if (stageType != STAGE_TYPE_UNDEFINED && change.getMode() == TRANSIT_TO_BACK) { // Collect all to back task's and evict them when transition finished. // Collect all to back task's and evict them when transition finished. Loading @@ -3118,7 +3126,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, SplitScreenTransitions.EnterSession pendingEnter = mSplitTransitions.mPendingEnter; SplitScreenTransitions.EnterSession pendingEnter = mSplitTransitions.mPendingEnter; if (pendingEnter.mExtraTransitType if (pendingEnter.mExtraTransitType == TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE) { == TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE) { // Open to side should only be used when split already active and foregorund. // Open to side should only be used when split already active and foregorund or when // app is restoring to split from fullscreen. if (mainChild == null && sideChild == null) { if (mainChild == null && sideChild == null) { Log.w(TAG, splitFailureMessage("startPendingEnterAnimation", Log.w(TAG, splitFailureMessage("startPendingEnterAnimation", "Launched a task in split, but didn't receive any task in transition.")); "Launched a task in split, but didn't receive any task in transition.")); Loading Loading @@ -3205,6 +3214,22 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, mPausingTasks.clear(); mPausingTasks.clear(); }); }); if (info.getType() == TRANSIT_CHANGE && !isSplitActive() && pendingEnter.mExtraTransitType == TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE) { if (finalMainChild != null && finalSideChild == null) { requestEnterSplitSelect(finalMainChild.getTaskInfo(), new WindowContainerTransaction(), getMainStagePosition(), finalMainChild.getStartAbsBounds()); } else if (finalSideChild != null && finalMainChild == null) { requestEnterSplitSelect(finalSideChild.getTaskInfo(), new WindowContainerTransaction(), getSideStagePosition(), finalSideChild.getStartAbsBounds()); } else { throw new IllegalStateException( "Attempting to restore to split but reparenting change not found"); } } finishEnterSplitScreen(finishT); finishEnterSplitScreen(finishT); addDividerBarToTransition(info, true /* show */); addDividerBarToTransition(info, true /* show */); return true; return true; Loading services/core/java/com/android/server/wm/ActivityClientController.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -1299,9 +1299,11 @@ class ActivityClientController extends IActivityClientController.Stub { // The restore windowing mode must be set after the windowing mode is set since // The restore windowing mode must be set after the windowing mode is set since // Task#setWindowingMode resets the restore windowing mode to WINDOWING_MODE_INVALID. // Task#setWindowingMode resets the restore windowing mode to WINDOWING_MODE_INVALID. requester.mMultiWindowRestoreWindowingMode = restoreWindowingMode; requester.mMultiWindowRestoreWindowingMode = restoreWindowingMode; requester.mMultiWindowRestoreParent = requester.getParent().mRemoteToken.toWindowContainerToken(); } else { } else { targetWindowingMode = requester.mMultiWindowRestoreWindowingMode; targetWindowingMode = requester.mMultiWindowRestoreWindowingMode; requester.setWindowingMode(targetWindowingMode); requester.restoreWindowingMode(); } } if (targetWindowingMode == WINDOWING_MODE_FULLSCREEN) { if (targetWindowingMode == WINDOWING_MODE_FULLSCREEN) { requester.setBounds(null); requester.setBounds(null); Loading services/core/java/com/android/server/wm/Task.java +20 −0 Original line number Original line Diff line number Diff line Loading @@ -445,6 +445,7 @@ class Task extends TaskFragment { int mPrevDisplayId = INVALID_DISPLAY; int mPrevDisplayId = INVALID_DISPLAY; int mMultiWindowRestoreWindowingMode = INVALID_WINDOWING_MODE; int mMultiWindowRestoreWindowingMode = INVALID_WINDOWING_MODE; WindowContainerToken mMultiWindowRestoreParent; /** /** * Last requested orientation reported to DisplayContent. This is different from {@link * Last requested orientation reported to DisplayContent. This is different from {@link Loading Loading @@ -4634,6 +4635,25 @@ class Task extends TaskFragment { return TASK; return TASK; } } /** * Restores to the windowing mode saved when task requested to enter fullscreen using * {@link Activity#requestFullscreenMode} API if it is valid. The task is also reparented to * the previous parent if parent has changed. */ void restoreWindowingMode() { if (mMultiWindowRestoreWindowingMode == INVALID_WINDOWING_MODE) { return; } if (!getParent().mRemoteToken.toWindowContainerToken() .equals(mMultiWindowRestoreParent)) { // Restore previous parent if parent has changed. final Task parent = fromWindowContainerToken(mMultiWindowRestoreParent); reparent(parent, MAX_VALUE); } setWindowingMode(mMultiWindowRestoreWindowingMode); } @Override @Override public void setWindowingMode(int windowingMode) { public void setWindowingMode(int windowingMode) { // Calling Task#setWindowingMode() for leaf task since this is a specialization of // Calling Task#setWindowingMode() for leaf task since this is a specialization of Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +27 −2 Original line number Original line Diff line number Diff line Loading @@ -2761,6 +2761,14 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, // cases above and it is not already visible // cases above and it is not already visible return null; return null; } else { } else { if (triggerTask.parentTaskId == mMainStage.mRootTaskInfo.taskId || triggerTask.parentTaskId == mSideStage.mRootTaskInfo.taskId) { ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "handleRequest: transition=%d " + "restoring to split", request.getDebugId()); out = new WindowContainerTransaction(); mSplitTransitions.setEnterTransition(transition, request.getRemoteTransition(), TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE, false /* resizeAnim */); } if (isOpening && getStageOfTask(triggerTask) != null) { if (isOpening && getStageOfTask(triggerTask) != null) { ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "handleRequest: transition=%d enter split", ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "handleRequest: transition=%d enter split", request.getDebugId()); request.getDebugId()); Loading Loading @@ -3107,7 +3115,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, // Includes TRANSIT_CHANGE to cover reparenting top-most task to split. // Includes TRANSIT_CHANGE to cover reparenting top-most task to split. mainChild = change; mainChild = change; } else if (sideChild == null && stageType == STAGE_TYPE_SIDE } else if (sideChild == null && stageType == STAGE_TYPE_SIDE && isOpeningType(change.getMode())) { && (isOpeningType(change.getMode()) || change.getMode() == TRANSIT_CHANGE)) { sideChild = change; sideChild = change; } else if (stageType != STAGE_TYPE_UNDEFINED && change.getMode() == TRANSIT_TO_BACK) { } else if (stageType != STAGE_TYPE_UNDEFINED && change.getMode() == TRANSIT_TO_BACK) { // Collect all to back task's and evict them when transition finished. // Collect all to back task's and evict them when transition finished. Loading @@ -3118,7 +3126,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, SplitScreenTransitions.EnterSession pendingEnter = mSplitTransitions.mPendingEnter; SplitScreenTransitions.EnterSession pendingEnter = mSplitTransitions.mPendingEnter; if (pendingEnter.mExtraTransitType if (pendingEnter.mExtraTransitType == TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE) { == TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE) { // Open to side should only be used when split already active and foregorund. // Open to side should only be used when split already active and foregorund or when // app is restoring to split from fullscreen. if (mainChild == null && sideChild == null) { if (mainChild == null && sideChild == null) { Log.w(TAG, splitFailureMessage("startPendingEnterAnimation", Log.w(TAG, splitFailureMessage("startPendingEnterAnimation", "Launched a task in split, but didn't receive any task in transition.")); "Launched a task in split, but didn't receive any task in transition.")); Loading Loading @@ -3205,6 +3214,22 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, mPausingTasks.clear(); mPausingTasks.clear(); }); }); if (info.getType() == TRANSIT_CHANGE && !isSplitActive() && pendingEnter.mExtraTransitType == TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE) { if (finalMainChild != null && finalSideChild == null) { requestEnterSplitSelect(finalMainChild.getTaskInfo(), new WindowContainerTransaction(), getMainStagePosition(), finalMainChild.getStartAbsBounds()); } else if (finalSideChild != null && finalMainChild == null) { requestEnterSplitSelect(finalSideChild.getTaskInfo(), new WindowContainerTransaction(), getSideStagePosition(), finalSideChild.getStartAbsBounds()); } else { throw new IllegalStateException( "Attempting to restore to split but reparenting change not found"); } } finishEnterSplitScreen(finishT); finishEnterSplitScreen(finishT); addDividerBarToTransition(info, true /* show */); addDividerBarToTransition(info, true /* show */); return true; return true; Loading
services/core/java/com/android/server/wm/ActivityClientController.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -1299,9 +1299,11 @@ class ActivityClientController extends IActivityClientController.Stub { // The restore windowing mode must be set after the windowing mode is set since // The restore windowing mode must be set after the windowing mode is set since // Task#setWindowingMode resets the restore windowing mode to WINDOWING_MODE_INVALID. // Task#setWindowingMode resets the restore windowing mode to WINDOWING_MODE_INVALID. requester.mMultiWindowRestoreWindowingMode = restoreWindowingMode; requester.mMultiWindowRestoreWindowingMode = restoreWindowingMode; requester.mMultiWindowRestoreParent = requester.getParent().mRemoteToken.toWindowContainerToken(); } else { } else { targetWindowingMode = requester.mMultiWindowRestoreWindowingMode; targetWindowingMode = requester.mMultiWindowRestoreWindowingMode; requester.setWindowingMode(targetWindowingMode); requester.restoreWindowingMode(); } } if (targetWindowingMode == WINDOWING_MODE_FULLSCREEN) { if (targetWindowingMode == WINDOWING_MODE_FULLSCREEN) { requester.setBounds(null); requester.setBounds(null); Loading
services/core/java/com/android/server/wm/Task.java +20 −0 Original line number Original line Diff line number Diff line Loading @@ -445,6 +445,7 @@ class Task extends TaskFragment { int mPrevDisplayId = INVALID_DISPLAY; int mPrevDisplayId = INVALID_DISPLAY; int mMultiWindowRestoreWindowingMode = INVALID_WINDOWING_MODE; int mMultiWindowRestoreWindowingMode = INVALID_WINDOWING_MODE; WindowContainerToken mMultiWindowRestoreParent; /** /** * Last requested orientation reported to DisplayContent. This is different from {@link * Last requested orientation reported to DisplayContent. This is different from {@link Loading Loading @@ -4634,6 +4635,25 @@ class Task extends TaskFragment { return TASK; return TASK; } } /** * Restores to the windowing mode saved when task requested to enter fullscreen using * {@link Activity#requestFullscreenMode} API if it is valid. The task is also reparented to * the previous parent if parent has changed. */ void restoreWindowingMode() { if (mMultiWindowRestoreWindowingMode == INVALID_WINDOWING_MODE) { return; } if (!getParent().mRemoteToken.toWindowContainerToken() .equals(mMultiWindowRestoreParent)) { // Restore previous parent if parent has changed. final Task parent = fromWindowContainerToken(mMultiWindowRestoreParent); reparent(parent, MAX_VALUE); } setWindowingMode(mMultiWindowRestoreWindowingMode); } @Override @Override public void setWindowingMode(int windowingMode) { public void setWindowingMode(int windowingMode) { // Calling Task#setWindowingMode() for leaf task since this is a specialization of // Calling Task#setWindowingMode() for leaf task since this is a specialization of Loading