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

Commit 5bf78506 authored by Orhan Uysal's avatar Orhan Uysal Committed by Android (Google) Code Review
Browse files

Merge "Let SplitScreenController handle the split tasks." into main

parents 02d1ac8f 78fab995
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ import com.android.wm.shell.common.SyncTransactionQueue
import com.android.wm.shell.common.annotations.ExternalThread
import com.android.wm.shell.common.annotations.ShellMainThread
import com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT
import com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT
import com.android.wm.shell.desktopmode.DesktopModeTaskRepository.VisibleTasksListener
import com.android.wm.shell.desktopmode.DragToDesktopTransitionHandler.DragToDesktopStateListener
import com.android.wm.shell.draganddrop.DragAndDropController
@@ -417,22 +416,8 @@ class DesktopTasksController(
                    splitScreenController.getStageOfTask(taskInfo.taskId),
                    EXIT_REASON_DESKTOP_MODE
            )
            getOtherSplitTask(taskInfo.taskId)?.let { otherTaskInfo ->
                wct.removeTask(otherTaskInfo.token)
        }
    }
    }

    private fun getOtherSplitTask(taskId: Int): RunningTaskInfo? {
        val remainingTaskPosition: Int =
                if (splitScreenController.getSplitPosition(taskId)
                        == SPLIT_POSITION_BOTTOM_OR_RIGHT) {
                    SPLIT_POSITION_TOP_OR_LEFT
                } else {
                    SPLIT_POSITION_BOTTOM_OR_RIGHT
                }
        return splitScreenController.getTaskInfo(remainingTaskPosition)
    }

    /**
     * The second part of the animated drag to desktop transition, called after
+3 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import static com.android.wm.shell.splitscreen.SplitScreenController.ENTER_REASO
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_APP_DOES_NOT_SUPPORT_MULTIWINDOW;
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_APP_FINISHED;
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_CHILD_TASK_ENTER_PIP;
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_DESKTOP_MODE;
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_DEVICE_FOLDED;
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_DRAG_DIVIDER;
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_FULLSCREEN_SHORTCUT;
@@ -1607,6 +1608,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                // The device is folded
            case EXIT_REASON_FULLSCREEN_SHORTCUT:
                // User has used a keyboard shortcut to go back to fullscreen from split
            case EXIT_REASON_DESKTOP_MODE:
                // One of the children enters desktop mode
                return true;
            default:
                return false;
+0 −7
Original line number Diff line number Diff line
@@ -420,7 +420,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
                    // been added, so they must be added here
                    mWindowDecorByTaskId.get(mTaskId).addCaptionInset(wct);
                    mDesktopTasksController.get().moveToDesktop(mTaskId, wct);
                    closeOtherSplitTask(mTaskId);
                }
                decoration.closeHandleMenu();
            } else if (id == R.id.fullscreen_button) {
@@ -1118,12 +1117,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
        return mSplitScreenController.getTaskInfo(remainingTaskPosition);
    }

    private void closeOtherSplitTask(int taskId) {
        if (isTaskInSplitScreen(taskId)) {
            mTaskOperations.closeTask(getOtherSplitTask(taskId).token);
        }
    }

    private boolean isTaskInSplitScreen(int taskId) {
        return mSplitScreenController != null
                && mSplitScreenController.isTaskInSplitScreen(taskId);