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

Commit f3445c32 authored by Tracy Zhou's avatar Tracy Zhou Committed by Android (Google) Code Review
Browse files

Merge "Map META+ALT+LEFT and META+ALT+RIGHT to changing split screen focus" into main

parents 3e3c4e84 5e0d2bc8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -375,6 +375,12 @@ oneway interface IStatusBar
     */
    void moveFocusedTaskToStageSplit(int displayId, boolean leftOrTop);

    /**
     * Set the split screen focus to the left / top app or the right / bottom app based on
     * {@param leftOrTop}.
     */
    void setSplitscreenFocus(boolean leftOrTop);

    /**
     * Shows the media output switcher dialog.
     *
+3 −0
Original line number Diff line number Diff line
@@ -105,6 +105,9 @@ public interface SplitScreen {
    /** Called when requested to go to fullscreen from the current active split app. */
    void goToFullscreenFromSplit();

    /** Called when splitscreen focused app is changed. */
    void setSplitscreenFocus(boolean leftOrTop);

    /** Get a string representation of a stage type */
    static String stageTypeToString(@StageType int stage) {
        switch (stage) {
+12 −0
Original line number Diff line number Diff line
@@ -485,6 +485,12 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
        }
    }

    public void setSplitscreenFocus(boolean leftOrTop) {
        if (mStageCoordinator.isSplitActive()) {
            mStageCoordinator.grantFocusToPosition(leftOrTop);
        }
    }

    /** Move the specified task to fullscreen, regardless of focus state. */
    public void moveTaskToFullscreen(int taskId, int exitReason) {
        mStageCoordinator.moveTaskToFullscreen(taskId, exitReason);
@@ -1152,6 +1158,12 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
        public void goToFullscreenFromSplit() {
            mMainExecutor.execute(SplitScreenController.this::goToFullscreenFromSplit);
        }

        @Override
        public void setSplitscreenFocus(boolean leftOrTop) {
            mMainExecutor.execute(
                    () -> SplitScreenController.this.setSplitscreenFocus(leftOrTop));
        }
    }

    /**
+5 −0
Original line number Diff line number Diff line
@@ -1604,6 +1604,11 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        }
    }

    protected void grantFocusToPosition(boolean leftOrTop) {
        grantFocusToStage(mSideStagePosition == SPLIT_POSITION_BOTTOM_OR_RIGHT
                ? getMainStagePosition() : getSideStagePosition());
    }

    private void clearRequestIfPresented() {
        ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "clearRequestIfPresented");
        if (mSideStageListener.mVisible && mSideStageListener.mHasChildren
+17 −0
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@ public class CommandQueue extends IStatusBar.Stub implements
    private static final int MSG_IMMERSIVE_CHANGED = 78 << MSG_SHIFT;
    private static final int MSG_SET_QS_TILES = 79 << MSG_SHIFT;
    private static final int MSG_ENTER_DESKTOP = 80 << MSG_SHIFT;
    private static final int MSG_SET_SPLITSCREEN_FOCUS = 81 << MSG_SHIFT;
    public static final int FLAG_EXCLUDE_NONE = 0;
    public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
    public static final int FLAG_EXCLUDE_RECENTS_PANEL = 1 << 1;
@@ -507,6 +508,11 @@ public class CommandQueue extends IStatusBar.Stub implements
         */
        default void moveFocusedTaskToStageSplit(int displayId, boolean leftOrTop) {}

        /**
         * @see IStatusBar#setSplitscreenFocus
         */
        default void setSplitscreenFocus(boolean leftOrTop) {}

        /**
         * @see IStatusBar#showMediaOutputSwitcher
         */
@@ -1348,6 +1354,12 @@ public class CommandQueue extends IStatusBar.Stub implements
        }
    }

    @Override
    public void setSplitscreenFocus(boolean leftOrTop) {
        synchronized (mLock) {
            mHandler.obtainMessage(MSG_SET_SPLITSCREEN_FOCUS, leftOrTop).sendToTarget();
        }
    }
    @Override
    public void showMediaOutputSwitcher(String packageName) {
        int callingUid = Binder.getCallingUid();
@@ -1919,6 +1931,11 @@ public class CommandQueue extends IStatusBar.Stub implements
                    }
                    break;
                }
                case MSG_SET_SPLITSCREEN_FOCUS:
                    for (int i = 0; i < mCallbacks.size(); i++) {
                        mCallbacks.get(i).setSplitscreenFocus((Boolean) msg.obj);
                    }
                    break;
                case MSG_SHOW_MEDIA_OUTPUT_SWITCHER:
                    args = (SomeArgs) msg.obj;
                    String clientPackageName = (String) args.arg1;
Loading