| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package com.android.wm.shell.splitscreen; |
| 18 |
|
| 19 |
import android.annotation.IntDef; |
| 20 |
import android.annotation.NonNull; |
| 21 |
import android.graphics.Rect; |
| 22 |
|
| 23 |
import com.android.wm.shell.common.annotations.ExternalThread; |
| 24 |
import com.android.wm.shell.common.split.SplitScreenConstants.SplitPosition; |
| 25 |
|
| 26 |
import java.util.concurrent.Executor; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
@ExternalThread |
| 33 |
public interface SplitScreen { |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
int STAGE_TYPE_UNDEFINED = -1; |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
int STAGE_TYPE_MAIN = 0; |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
int STAGE_TYPE_SIDE = 1; |
| 50 |
|
| 51 |
@IntDef(prefix = { "STAGE_TYPE_" }, value = { |
| 52 |
STAGE_TYPE_UNDEFINED, |
| 53 |
STAGE_TYPE_MAIN, |
| 54 |
STAGE_TYPE_SIDE |
| 55 |
}) |
| 56 |
@interface StageType {} |
| 57 |
|
| 58 |
|
| 59 |
interface SplitScreenListener { |
| 60 |
default void onStagePositionChanged(@StageType int stage, @SplitPosition int position) {} |
| 61 |
default void onTaskStageChanged(int taskId, @StageType int stage, boolean visible) {} |
| 62 |
default void onSplitBoundsChanged(Rect rootBounds, Rect mainBounds, Rect sideBounds) {} |
| 63 |
default void onSplitVisibilityChanged(boolean visible) {} |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
void registerSplitScreenListener(@NonNull SplitScreenListener listener, |
| 68 |
@NonNull Executor executor); |
| 69 |
|
| 70 |
|
| 71 |
void unregisterSplitScreenListener(@NonNull SplitScreenListener listener); |
| 72 |
|
| 73 |
|
| 74 |
void onFinishedWakingUp(); |
| 75 |
|
| 76 |
|
| 77 |
void goToFullscreenFromSplit(); |
| 78 |
|
| 79 |
|
| 80 |
static String stageTypeToString(@StageType int stage) { |
| 81 |
switch (stage) { |
| 82 |
case STAGE_TYPE_UNDEFINED: return "UNDEFINED"; |
| 83 |
case STAGE_TYPE_MAIN: return "MAIN"; |
| 84 |
case STAGE_TYPE_SIDE: return "SIDE"; |
| 85 |
default: return "UNKNOWN(" + stage + ")"; |
| 86 |
} |
| 87 |
} |
| 88 |
} |