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

Commit 87de473c authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge "Add method for exit split screen with shell transit" into main

parents 6a9ee51e 5fc6a3bb
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -436,8 +436,12 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
    }

    public void exitSplitScreen(int toTopTaskId, @ExitReason int exitReason) {
        if (ENABLE_SHELL_TRANSITIONS) {
            mStageCoordinator.dismissSplitScreen(toTopTaskId, exitReason);
        } else {
            mStageCoordinator.exitSplitScreen(toTopTaskId, exitReason);
        }
    }

    @Override
    public void onKeyguardVisibilityChanged(boolean visible, boolean occluded,
+16 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.wm.shell.splitscreen;

import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT;
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_UNKNOWN;

import com.android.wm.shell.sysui.ShellCommandHandler;

@@ -45,6 +46,8 @@ public class SplitScreenShellCommandHandler implements
                return runSetSideStagePosition(args, pw);
            case "switchSplitPosition":
                return runSwitchSplitPosition();
            case "exitSplitScreen":
                return runExitSplitScreen(args, pw);
            default:
                pw.println("Invalid command: " + args[0]);
                return false;
@@ -91,6 +94,17 @@ public class SplitScreenShellCommandHandler implements
        return true;
    }

    private boolean runExitSplitScreen(String[] args, PrintWriter pw) {
        if (args.length < 2) {
            // First argument is the action name.
            pw.println("Error: task id should be provided as arguments");
            return false;
        }
        final int taskId = Integer.parseInt(args[1]);
        mController.exitSplitScreen(taskId, EXIT_REASON_UNKNOWN);
        return true;
    }

    @Override
    public void printShellCommandHelp(PrintWriter pw, String prefix) {
        pw.println(prefix + "moveToSideStage <taskId> <SideStagePosition>");
@@ -101,5 +115,7 @@ public class SplitScreenShellCommandHandler implements
        pw.println(prefix + "  Sets the position of the side-stage.");
        pw.println(prefix + "switchSplitPosition");
        pw.println(prefix + "  Reverses the split.");
        pw.println(prefix + "exitSplitScreen <taskId>");
        pw.println(prefix + "  Exits split screen and leaves the provided split task on top.");
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -1451,6 +1451,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        mExitSplitScreenOnHide = exitSplitScreenOnHide;
    }

    /** Exits split screen with legacy transition */
    void exitSplitScreen(int toTopTaskId, @ExitReason int exitReason) {
        ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "exitSplitScreen: topTaskId=%d reason=%s active=%b",
                toTopTaskId, exitReasonToString(exitReason), mMainStage.isActive());
@@ -1470,6 +1471,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        applyExitSplitScreen(childrenToTop, wct, exitReason);
    }

    /** Exits split screen with legacy transition */
    private void exitSplitScreen(@Nullable StageTaskListener childrenToTop,
            @ExitReason int exitReason) {
        ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "exitSplitScreen: mainStageToTop=%b reason=%s active=%b",
@@ -1547,6 +1549,14 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        }
    }

    void dismissSplitScreen(int toTopTaskId, @ExitReason int exitReason) {
        if (!mMainStage.isActive()) return;
        final int stage = getStageOfTask(toTopTaskId);
        final WindowContainerTransaction wct = new WindowContainerTransaction();
        prepareExitSplitScreen(stage, wct);
        mSplitTransitions.startDismissTransition(wct, this, stage, exitReason);
    }

    /**
     * Overridden by child classes.
     */
@@ -1612,6 +1622,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                // 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
            case EXIT_REASON_UNKNOWN:
                // Unknown reason
                return true;
            default:
                return false;