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

Commit 64a43eba authored by Jeremy Sim's avatar Jeremy Sim
Browse files

Add convenience function for SPLIT_INDEX constants

Bug: 349828130
Flag: com.android.wm.shell.enable_flexible_split
Test: No effect on behavior, just a small refactor.
Change-Id: I5498519f804f6e8a39374d7cb405eaedcac230d8
parent 117c9b02
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -58,6 +58,11 @@ public class SplitScreenConstants {
     */
    public static final int SPLIT_POSITION_BOTTOM_OR_RIGHT = 1;

    /**
     * Deprecated and will be replaced fully by @SplitIndex. With support for 3+ apps in split,
     * existing references to top/left and bottom/right will be replaced by INDEX_0 and INDEX_1
     * respectively. For now they can be used interchangeably, the underlying ints are the same.
     */
    @IntDef(prefix = {"SPLIT_POSITION_"}, value = {
            SPLIT_POSITION_UNDEFINED,
            SPLIT_POSITION_TOP_OR_LEFT,
@@ -85,6 +90,21 @@ public class SplitScreenConstants {
    public @interface SplitIndex {
    }

    /**
     * Return the @SplitIndex constant for a given integer index. @SplitIndex is the replacement
     * for @SplitPosition, and will be used interchangeably with @SplitPosition to support 3+ apps
     * in split.
     */
    public static int getIndex(int i) {
        return switch (i) {
            case 0 -> SPLIT_INDEX_0;
            case 1 -> SPLIT_INDEX_1;
            case 2 -> SPLIT_INDEX_2;
            case 3 -> SPLIT_INDEX_3;
            default -> SPLIT_INDEX_UNDEFINED;
        };
    }

    /** Signifies that user is currently not in split screen. */
    public static final int NOT_IN_SPLIT = -1;