Adjust split layout with IME animation in split (1/N)
Update StagePosition to more general SplitPosition so that it could be shared among split implementations. Bug: 179262787 Test: atest WMShellUnitTests Change-Id: I6f461fac62d350f50171136f079cb0254b06d767
This commit is contained in:
@@ -16,14 +16,14 @@
|
||||
|
||||
package com.android.wm.shell;
|
||||
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
||||
|
||||
import com.android.wm.shell.apppairs.AppPairsController;
|
||||
import com.android.wm.shell.common.ShellExecutor;
|
||||
import com.android.wm.shell.pip.Pip;
|
||||
import com.android.wm.shell.hidedisplaycutout.HideDisplayCutoutController;
|
||||
import com.android.wm.shell.legacysplitscreen.LegacySplitScreenController;
|
||||
import com.android.wm.shell.onehanded.OneHandedController;
|
||||
import com.android.wm.shell.pip.Pip;
|
||||
import com.android.wm.shell.splitscreen.SplitScreenController;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
@@ -145,7 +145,7 @@ public final class ShellCommandHandlerImpl {
|
||||
}
|
||||
final int taskId = new Integer(args[2]);
|
||||
final int sideStagePosition = args.length > 3
|
||||
? new Integer(args[3]) : STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
? new Integer(args[3]) : SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
||||
mSplitScreenOptional.ifPresent(split -> split.moveToSideStage(taskId, sideStagePosition));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import static com.android.internal.policy.DividerSnapAlgorithm.SnapTarget.FLAG_D
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.IntDef;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
@@ -42,7 +43,32 @@ import com.android.wm.shell.common.DisplayImeController;
|
||||
* Records and handles layout of splits. Helps to calculate proper bounds when configuration or
|
||||
* divide position changes.
|
||||
*/
|
||||
public class SplitLayout {
|
||||
public final class SplitLayout {
|
||||
/**
|
||||
* Split position isn't specified normally meaning to use what ever it is currently set to.
|
||||
*/
|
||||
public static final int SPLIT_POSITION_UNDEFINED = -1;
|
||||
|
||||
/**
|
||||
* Specifies that a split is positioned at the top half of the screen if
|
||||
* in portrait mode or at the left half of the screen if in landscape mode.
|
||||
*/
|
||||
public static final int SPLIT_POSITION_TOP_OR_LEFT = 0;
|
||||
|
||||
/**
|
||||
* Specifies that a split is positioned at the bottom half of the screen if
|
||||
* in portrait mode or at the right half of the screen if in landscape mode.
|
||||
*/
|
||||
public static final int SPLIT_POSITION_BOTTOM_OR_RIGHT = 1;
|
||||
|
||||
@IntDef(prefix = {"SPLIT_POSITION_"}, value = {
|
||||
SPLIT_POSITION_UNDEFINED,
|
||||
SPLIT_POSITION_TOP_OR_LEFT,
|
||||
SPLIT_POSITION_BOTTOM_OR_RIGHT
|
||||
})
|
||||
public @interface SplitPosition {
|
||||
}
|
||||
|
||||
private final int mDividerWindowWidth;
|
||||
private final int mDividerInsets;
|
||||
private final int mDividerSize;
|
||||
|
||||
@@ -29,14 +29,14 @@ import static android.content.Intent.EXTRA_SHORTCUT_ID;
|
||||
import static android.content.Intent.EXTRA_TASK_ID;
|
||||
import static android.content.Intent.EXTRA_USER;
|
||||
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_UNDEFINED;
|
||||
import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_FULLSCREEN;
|
||||
import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPLIT_BOTTOM;
|
||||
import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPLIT_LEFT;
|
||||
import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPLIT_RIGHT;
|
||||
import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPLIT_TOP;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_POSITION_UNDEFINED;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_SIDE;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_UNDEFINED;
|
||||
|
||||
@@ -64,7 +64,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.wm.shell.common.DisplayLayout;
|
||||
import com.android.wm.shell.splitscreen.SplitScreen.StagePosition;
|
||||
import com.android.wm.shell.common.split.SplitLayout.SplitPosition;
|
||||
import com.android.wm.shell.splitscreen.SplitScreen.StageType;
|
||||
import com.android.wm.shell.splitscreen.SplitScreenController;
|
||||
|
||||
@@ -203,10 +203,10 @@ public class DragAndDropPolicy {
|
||||
final boolean leftOrTop = target.type == TYPE_SPLIT_TOP || target.type == TYPE_SPLIT_LEFT;
|
||||
|
||||
@StageType int stage = STAGE_TYPE_UNDEFINED;
|
||||
@StagePosition int position = STAGE_POSITION_UNDEFINED;
|
||||
@SplitPosition int position = SPLIT_POSITION_UNDEFINED;
|
||||
if (target.type != TYPE_FULLSCREEN && mSplitScreen != null) {
|
||||
// Update launch options for the split side we are targeting.
|
||||
position = leftOrTop ? STAGE_POSITION_TOP_OR_LEFT : STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
position = leftOrTop ? SPLIT_POSITION_TOP_OR_LEFT : SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
||||
if (!inSplitScreen) {
|
||||
// Launch in the side stage if we are not in split-screen already.
|
||||
stage = STAGE_TYPE_SIDE;
|
||||
@@ -219,7 +219,7 @@ public class DragAndDropPolicy {
|
||||
}
|
||||
|
||||
private void startClipDescription(ClipDescription description, Intent intent,
|
||||
@StageType int stage, @StagePosition int position) {
|
||||
@StageType int stage, @SplitPosition int position) {
|
||||
final boolean isTask = description.hasMimeType(MIMETYPE_APPLICATION_TASK);
|
||||
final boolean isShortcut = description.hasMimeType(MIMETYPE_APPLICATION_SHORTCUT);
|
||||
final Bundle opts = intent.hasExtra(EXTRA_ACTIVITY_OPTIONS)
|
||||
@@ -291,12 +291,12 @@ public class DragAndDropPolicy {
|
||||
* Interface for actually committing the task launches.
|
||||
*/
|
||||
public interface Starter {
|
||||
void startTask(int taskId, @StageType int stage, @StagePosition int position,
|
||||
void startTask(int taskId, @StageType int stage, @SplitPosition int position,
|
||||
@Nullable Bundle options);
|
||||
void startShortcut(String packageName, String shortcutId, @StageType int stage,
|
||||
@StagePosition int position, @Nullable Bundle options, UserHandle user);
|
||||
@SplitPosition int position, @Nullable Bundle options, UserHandle user);
|
||||
void startIntent(PendingIntent intent, Intent fillInIntent,
|
||||
@StageType int stage, @StagePosition int position,
|
||||
@StageType int stage, @SplitPosition int position,
|
||||
@Nullable Bundle options);
|
||||
void enterSplitScreen(int taskId, boolean leftOrTop);
|
||||
void exitSplitScreen();
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.wm.shell.splitscreen;
|
||||
import android.annotation.IntDef;
|
||||
|
||||
import com.android.wm.shell.common.annotations.ExternalThread;
|
||||
import com.android.wm.shell.common.split.SplitLayout.SplitPosition;
|
||||
|
||||
/**
|
||||
* Interface to engage split-screen feature.
|
||||
@@ -26,29 +27,6 @@ import com.android.wm.shell.common.annotations.ExternalThread;
|
||||
*/
|
||||
@ExternalThread
|
||||
public interface SplitScreen {
|
||||
/**
|
||||
* Stage position isn't specified normally meaning to use what ever it is currently set to.
|
||||
*/
|
||||
int STAGE_POSITION_UNDEFINED = -1;
|
||||
/**
|
||||
* Specifies that a stage is positioned at the top half of the screen if
|
||||
* in portrait mode or at the left half of the screen if in landscape mode.
|
||||
*/
|
||||
int STAGE_POSITION_TOP_OR_LEFT = 0;
|
||||
|
||||
/**
|
||||
* Specifies that a stage is positioned at the bottom half of the screen if
|
||||
* in portrait mode or at the right half of the screen if in landscape mode.
|
||||
*/
|
||||
int STAGE_POSITION_BOTTOM_OR_RIGHT = 1;
|
||||
|
||||
@IntDef(prefix = { "STAGE_POSITION_" }, value = {
|
||||
STAGE_POSITION_UNDEFINED,
|
||||
STAGE_POSITION_TOP_OR_LEFT,
|
||||
STAGE_POSITION_BOTTOM_OR_RIGHT
|
||||
})
|
||||
@interface StagePosition {}
|
||||
|
||||
/**
|
||||
* Stage type isn't specified normally meaning to use what ever the default is.
|
||||
* E.g. exit split-screen and launch the app in fullscreen.
|
||||
@@ -75,7 +53,7 @@ public interface SplitScreen {
|
||||
|
||||
/** Callback interface for listening to changes in a split-screen stage. */
|
||||
interface SplitScreenListener {
|
||||
void onStagePositionChanged(@StageType int stage, @StagePosition int position);
|
||||
void onStagePositionChanged(@StageType int stage, @SplitPosition int position);
|
||||
void onTaskStageChanged(int taskId, @StageType int stage, boolean visible);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ package com.android.wm.shell.splitscreen;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_POSITION_UNDEFINED;
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_UNDEFINED;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_MAIN;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_SIDE;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_UNDEFINED;
|
||||
@@ -53,6 +53,7 @@ import com.android.wm.shell.common.ShellExecutor;
|
||||
import com.android.wm.shell.common.SyncTransactionQueue;
|
||||
import com.android.wm.shell.common.TransactionPool;
|
||||
import com.android.wm.shell.common.annotations.ExternalThread;
|
||||
import com.android.wm.shell.common.split.SplitLayout.SplitPosition;
|
||||
import com.android.wm.shell.draganddrop.DragAndDropPolicy;
|
||||
import com.android.wm.shell.splitscreen.ISplitScreenListener;
|
||||
import com.android.wm.shell.transition.Transitions;
|
||||
@@ -122,7 +123,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
return mStageCoordinator.isSplitScreenVisible();
|
||||
}
|
||||
|
||||
public boolean moveToSideStage(int taskId, @SplitScreen.StagePosition int sideStagePosition) {
|
||||
public boolean moveToSideStage(int taskId, @SplitPosition int sideStagePosition) {
|
||||
final ActivityManager.RunningTaskInfo task = mTaskOrganizer.getRunningTaskInfo(taskId);
|
||||
if (task == null) {
|
||||
throw new IllegalArgumentException("Unknown taskId" + taskId);
|
||||
@@ -131,7 +132,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
}
|
||||
|
||||
public boolean moveToSideStage(ActivityManager.RunningTaskInfo task,
|
||||
@SplitScreen.StagePosition int sideStagePosition) {
|
||||
@SplitPosition int sideStagePosition) {
|
||||
return mStageCoordinator.moveToSideStage(task, sideStagePosition);
|
||||
}
|
||||
|
||||
@@ -139,7 +140,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
return mStageCoordinator.removeFromSideStage(taskId);
|
||||
}
|
||||
|
||||
public void setSideStagePosition(@SplitScreen.StagePosition int sideStagePosition) {
|
||||
public void setSideStagePosition(@SplitPosition int sideStagePosition) {
|
||||
mStageCoordinator.setSideStagePosition(sideStagePosition);
|
||||
}
|
||||
|
||||
@@ -149,7 +150,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
|
||||
public void enterSplitScreen(int taskId, boolean leftOrTop) {
|
||||
moveToSideStage(taskId,
|
||||
leftOrTop ? STAGE_POSITION_TOP_OR_LEFT : STAGE_POSITION_BOTTOM_OR_RIGHT);
|
||||
leftOrTop ? SPLIT_POSITION_TOP_OR_LEFT : SPLIT_POSITION_BOTTOM_OR_RIGHT);
|
||||
}
|
||||
|
||||
public void exitSplitScreen() {
|
||||
@@ -173,7 +174,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
}
|
||||
|
||||
public void startTask(int taskId, @SplitScreen.StageType int stage,
|
||||
@SplitScreen.StagePosition int position, @Nullable Bundle options) {
|
||||
@SplitPosition int position, @Nullable Bundle options) {
|
||||
options = resolveStartStage(stage, position, options);
|
||||
|
||||
try {
|
||||
@@ -184,7 +185,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
}
|
||||
|
||||
public void startShortcut(String packageName, String shortcutId,
|
||||
@SplitScreen.StageType int stage, @SplitScreen.StagePosition int position,
|
||||
@SplitScreen.StageType int stage, @SplitPosition int position,
|
||||
@Nullable Bundle options, UserHandle user) {
|
||||
options = resolveStartStage(stage, position, options);
|
||||
|
||||
@@ -199,7 +200,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
}
|
||||
|
||||
public void startIntent(PendingIntent intent, Intent fillInIntent,
|
||||
@SplitScreen.StageType int stage, @SplitScreen.StagePosition int position,
|
||||
@SplitScreen.StageType int stage, @SplitPosition int position,
|
||||
@Nullable Bundle options) {
|
||||
options = resolveStartStage(stage, position, options);
|
||||
|
||||
@@ -211,11 +212,11 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
}
|
||||
|
||||
private Bundle resolveStartStage(@SplitScreen.StageType int stage,
|
||||
@SplitScreen.StagePosition int position, @Nullable Bundle options) {
|
||||
@SplitPosition int position, @Nullable Bundle options) {
|
||||
switch (stage) {
|
||||
case STAGE_TYPE_UNDEFINED: {
|
||||
// Use the stage of the specified position is valid.
|
||||
if (position != STAGE_POSITION_UNDEFINED) {
|
||||
if (position != SPLIT_POSITION_UNDEFINED) {
|
||||
if (position == mStageCoordinator.getSideStagePosition()) {
|
||||
options = resolveStartStage(STAGE_TYPE_SIDE, position, options);
|
||||
} else {
|
||||
@@ -228,7 +229,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
break;
|
||||
}
|
||||
case STAGE_TYPE_SIDE: {
|
||||
if (position != STAGE_POSITION_UNDEFINED) {
|
||||
if (position != SPLIT_POSITION_UNDEFINED) {
|
||||
mStageCoordinator.setSideStagePosition(position);
|
||||
} else {
|
||||
position = mStageCoordinator.getSideStagePosition();
|
||||
@@ -240,10 +241,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
break;
|
||||
}
|
||||
case STAGE_TYPE_MAIN: {
|
||||
if (position != STAGE_POSITION_UNDEFINED) {
|
||||
if (position != SPLIT_POSITION_UNDEFINED) {
|
||||
// Set the side stage opposite of what we want to the main stage.
|
||||
final int sideStagePosition = position == STAGE_POSITION_TOP_OR_LEFT
|
||||
? STAGE_POSITION_BOTTOM_OR_RIGHT : STAGE_POSITION_TOP_OR_LEFT;
|
||||
final int sideStagePosition = position == SPLIT_POSITION_TOP_OR_LEFT
|
||||
? SPLIT_POSITION_BOTTOM_OR_RIGHT : SPLIT_POSITION_TOP_OR_LEFT;
|
||||
mStageCoordinator.setSideStagePosition(sideStagePosition);
|
||||
} else {
|
||||
position = mStageCoordinator.getMainStagePosition();
|
||||
@@ -418,7 +419,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
@Override
|
||||
public void startTasks(int mainTaskId, @Nullable Bundle mainOptions,
|
||||
int sideTaskId, @Nullable Bundle sideOptions,
|
||||
@SplitScreen.StagePosition int sidePosition,
|
||||
@SplitPosition int sidePosition,
|
||||
@Nullable IRemoteTransition remoteTransition) {
|
||||
executeRemoteCallWithTaskPermission(mController, "startTasks",
|
||||
(controller) -> controller.mStageCoordinator.startTasks(mainTaskId, mainOptions,
|
||||
|
||||
@@ -25,8 +25,8 @@ import static android.view.WindowManager.TRANSIT_TO_BACK;
|
||||
import static android.view.WindowManager.TRANSIT_TO_FRONT;
|
||||
import static android.view.WindowManager.transitTypeToString;
|
||||
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_MAIN;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_SIDE;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_UNDEFINED;
|
||||
@@ -54,7 +54,6 @@ import android.window.TransitionInfo;
|
||||
import android.window.TransitionRequestInfo;
|
||||
import android.window.WindowContainerTransaction;
|
||||
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.protolog.common.ProtoLog;
|
||||
@@ -64,6 +63,7 @@ import com.android.wm.shell.common.DisplayImeController;
|
||||
import com.android.wm.shell.common.SyncTransactionQueue;
|
||||
import com.android.wm.shell.common.TransactionPool;
|
||||
import com.android.wm.shell.common.split.SplitLayout;
|
||||
import com.android.wm.shell.common.split.SplitLayout.SplitPosition;
|
||||
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
||||
import com.android.wm.shell.transition.Transitions;
|
||||
|
||||
@@ -96,7 +96,8 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
|
||||
private final StageListenerImpl mMainStageListener = new StageListenerImpl();
|
||||
private final SideStage mSideStage;
|
||||
private final StageListenerImpl mSideStageListener = new StageListenerImpl();
|
||||
private @SplitScreen.StagePosition int mSideStagePosition = STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
@SplitPosition
|
||||
private int mSideStagePosition = SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
||||
|
||||
private final int mDisplayId;
|
||||
private SplitLayout mSplitLayout;
|
||||
@@ -176,7 +177,7 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
|
||||
}
|
||||
|
||||
boolean moveToSideStage(ActivityManager.RunningTaskInfo task,
|
||||
@SplitScreen.StagePosition int sideStagePosition) {
|
||||
@SplitPosition int sideStagePosition) {
|
||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||
setSideStagePosition(sideStagePosition);
|
||||
mMainStage.activate(getMainStageBounds(), wct);
|
||||
@@ -201,7 +202,7 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
|
||||
|
||||
/** Starts 2 tasks in one transition. */
|
||||
void startTasks(int mainTaskId, @Nullable Bundle mainOptions, int sideTaskId,
|
||||
@Nullable Bundle sideOptions, @SplitScreen.StagePosition int sidePosition,
|
||||
@Nullable Bundle sideOptions, @SplitPosition int sidePosition,
|
||||
@Nullable IRemoteTransition remoteTransition) {
|
||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||
mainOptions = mainOptions != null ? mainOptions : new Bundle();
|
||||
@@ -225,20 +226,22 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
|
||||
TRANSIT_SPLIT_SCREEN_PAIR_OPEN, wct, remoteTransition, this);
|
||||
}
|
||||
|
||||
@SplitScreen.StagePosition int getSideStagePosition() {
|
||||
@SplitLayout.SplitPosition
|
||||
int getSideStagePosition() {
|
||||
return mSideStagePosition;
|
||||
}
|
||||
|
||||
@SplitScreen.StagePosition int getMainStagePosition() {
|
||||
return mSideStagePosition == STAGE_POSITION_TOP_OR_LEFT
|
||||
? STAGE_POSITION_BOTTOM_OR_RIGHT : STAGE_POSITION_TOP_OR_LEFT;
|
||||
@SplitLayout.SplitPosition
|
||||
int getMainStagePosition() {
|
||||
return mSideStagePosition == SPLIT_POSITION_TOP_OR_LEFT
|
||||
? SPLIT_POSITION_BOTTOM_OR_RIGHT : SPLIT_POSITION_TOP_OR_LEFT;
|
||||
}
|
||||
|
||||
void setSideStagePosition(@SplitScreen.StagePosition int sideStagePosition) {
|
||||
void setSideStagePosition(@SplitPosition int sideStagePosition) {
|
||||
setSideStagePosition(sideStagePosition, true /* updateVisibility */);
|
||||
}
|
||||
|
||||
private void setSideStagePosition(@SplitScreen.StagePosition int sideStagePosition,
|
||||
private void setSideStagePosition(@SplitPosition int sideStagePosition,
|
||||
boolean updateVisibility) {
|
||||
if (mSideStagePosition == sideStagePosition) return;
|
||||
mSideStagePosition = sideStagePosition;
|
||||
@@ -289,7 +292,7 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
|
||||
opts.putParcelable(KEY_LAUNCH_ROOT_TASK_TOKEN, stage.mRootTaskInfo.token);
|
||||
}
|
||||
|
||||
void updateActivityOptions(Bundle opts, @SplitScreen.StagePosition int position) {
|
||||
void updateActivityOptions(Bundle opts, @SplitPosition int position) {
|
||||
addActivityOptions(opts, position == mSideStagePosition ? mSideStage : mMainStage);
|
||||
|
||||
if (!mMainStage.isActive()) {
|
||||
@@ -487,8 +490,8 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
|
||||
@Override
|
||||
public void onSnappedToDismiss(boolean bottomOrRight) {
|
||||
final boolean mainStageToTop =
|
||||
bottomOrRight ? mSideStagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT
|
||||
: mSideStagePosition == STAGE_POSITION_TOP_OR_LEFT;
|
||||
bottomOrRight ? mSideStagePosition == SPLIT_POSITION_BOTTOM_OR_RIGHT
|
||||
: mSideStagePosition == SPLIT_POSITION_TOP_OR_LEFT;
|
||||
if (ENABLE_SHELL_TRANSITIONS) {
|
||||
onSnappedToDismissTransition(mainStageToTop);
|
||||
return;
|
||||
@@ -519,8 +522,8 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
|
||||
|
||||
@Override
|
||||
public void onDoubleTappedDivider() {
|
||||
setSideStagePosition(mSideStagePosition == STAGE_POSITION_TOP_OR_LEFT
|
||||
? STAGE_POSITION_BOTTOM_OR_RIGHT : STAGE_POSITION_TOP_OR_LEFT);
|
||||
setSideStagePosition(mSideStagePosition == SPLIT_POSITION_TOP_OR_LEFT
|
||||
? SPLIT_POSITION_BOTTOM_OR_RIGHT : SPLIT_POSITION_TOP_OR_LEFT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -574,12 +577,12 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
|
||||
}
|
||||
|
||||
private Rect getSideStageBounds() {
|
||||
return mSideStagePosition == STAGE_POSITION_TOP_OR_LEFT
|
||||
return mSideStagePosition == SPLIT_POSITION_TOP_OR_LEFT
|
||||
? mSplitLayout.getBounds1() : mSplitLayout.getBounds2();
|
||||
}
|
||||
|
||||
private Rect getMainStageBounds() {
|
||||
return mSideStagePosition == STAGE_POSITION_TOP_OR_LEFT
|
||||
return mSideStagePosition == SPLIT_POSITION_TOP_OR_LEFT
|
||||
? mSplitLayout.getBounds2() : mSplitLayout.getBounds1();
|
||||
}
|
||||
|
||||
@@ -742,7 +745,7 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
|
||||
|
||||
// Update local states (before animating).
|
||||
setDividerVisibility(true);
|
||||
setSideStagePosition(STAGE_POSITION_BOTTOM_OR_RIGHT, false /* updateVisibility */);
|
||||
setSideStagePosition(SPLIT_POSITION_BOTTOM_OR_RIGHT, false /* updateVisibility */);
|
||||
setSplitsVisible(true);
|
||||
|
||||
addDividerBarToTransition(info, t, true /* show */);
|
||||
|
||||
@@ -24,13 +24,13 @@ import static android.content.ClipDescription.MIMETYPE_APPLICATION_ACTIVITY;
|
||||
import static android.content.ClipDescription.MIMETYPE_APPLICATION_SHORTCUT;
|
||||
import static android.content.ClipDescription.MIMETYPE_APPLICATION_TASK;
|
||||
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_UNDEFINED;
|
||||
import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_FULLSCREEN;
|
||||
import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPLIT_BOTTOM;
|
||||
import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPLIT_LEFT;
|
||||
import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPLIT_RIGHT;
|
||||
import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPLIT_TOP;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_POSITION_UNDEFINED;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_SIDE;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_UNDEFINED;
|
||||
|
||||
@@ -206,7 +206,7 @@ public class DragAndDropPolicyTest {
|
||||
|
||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||
verify(mSplitScreenStarter).startIntent(any(), any(),
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(SPLIT_POSITION_UNDEFINED), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -218,12 +218,12 @@ public class DragAndDropPolicyTest {
|
||||
|
||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||
verify(mSplitScreenStarter).startIntent(any(), any(),
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(SPLIT_POSITION_UNDEFINED), any());
|
||||
reset(mSplitScreenStarter);
|
||||
|
||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_SPLIT_RIGHT), mActivityClipData);
|
||||
verify(mSplitScreenStarter).startIntent(any(), any(),
|
||||
eq(STAGE_TYPE_SIDE), eq(STAGE_POSITION_BOTTOM_OR_RIGHT), any());
|
||||
eq(STAGE_TYPE_SIDE), eq(SPLIT_POSITION_BOTTOM_OR_RIGHT), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -235,12 +235,12 @@ public class DragAndDropPolicyTest {
|
||||
|
||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||
verify(mSplitScreenStarter).startIntent(any(), any(),
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(SPLIT_POSITION_UNDEFINED), any());
|
||||
reset(mSplitScreenStarter);
|
||||
|
||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_SPLIT_BOTTOM), mActivityClipData);
|
||||
verify(mSplitScreenStarter).startIntent(any(), any(),
|
||||
eq(STAGE_TYPE_SIDE), eq(STAGE_POSITION_BOTTOM_OR_RIGHT), any());
|
||||
eq(STAGE_TYPE_SIDE), eq(SPLIT_POSITION_BOTTOM_OR_RIGHT), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -252,7 +252,7 @@ public class DragAndDropPolicyTest {
|
||||
|
||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||
verify(mSplitScreenStarter).startIntent(any(), any(),
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(SPLIT_POSITION_UNDEFINED), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -264,7 +264,7 @@ public class DragAndDropPolicyTest {
|
||||
|
||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||
verify(mSplitScreenStarter).startIntent(any(), any(),
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(SPLIT_POSITION_UNDEFINED), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -277,13 +277,13 @@ public class DragAndDropPolicyTest {
|
||||
|
||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||
verify(mSplitScreenStarter).startIntent(any(), any(),
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(SPLIT_POSITION_UNDEFINED), any());
|
||||
reset(mSplitScreenStarter);
|
||||
|
||||
// TODO(b/169894807): Just verify starting for the non-docked task until we have app pairs
|
||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_SPLIT_RIGHT), mActivityClipData);
|
||||
verify(mSplitScreenStarter).startIntent(any(), any(),
|
||||
eq(STAGE_TYPE_SIDE), eq(STAGE_POSITION_BOTTOM_OR_RIGHT), any());
|
||||
eq(STAGE_TYPE_SIDE), eq(SPLIT_POSITION_BOTTOM_OR_RIGHT), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -296,13 +296,13 @@ public class DragAndDropPolicyTest {
|
||||
|
||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||
verify(mSplitScreenStarter).startIntent(any(), any(),
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||
eq(STAGE_TYPE_UNDEFINED), eq(SPLIT_POSITION_UNDEFINED), any());
|
||||
reset(mSplitScreenStarter);
|
||||
|
||||
// TODO(b/169894807): Just verify starting for the non-docked task until we have app pairs
|
||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_SPLIT_BOTTOM), mActivityClipData);
|
||||
verify(mSplitScreenStarter).startIntent(any(), any(),
|
||||
eq(STAGE_TYPE_SIDE), eq(STAGE_POSITION_BOTTOM_OR_RIGHT), any());
|
||||
eq(STAGE_TYPE_SIDE), eq(SPLIT_POSITION_BOTTOM_OR_RIGHT), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.android.wm.shell.splitscreen;
|
||||
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
@@ -73,7 +73,7 @@ public class StageCoordinatorTests extends ShellTestCase {
|
||||
public void testMoveToSideStage() {
|
||||
final ActivityManager.RunningTaskInfo task = new TestRunningTaskInfoBuilder().build();
|
||||
|
||||
mStageCoordinator.moveToSideStage(task, STAGE_POSITION_BOTTOM_OR_RIGHT);
|
||||
mStageCoordinator.moveToSideStage(task, SPLIT_POSITION_BOTTOM_OR_RIGHT);
|
||||
|
||||
verify(mMainStage).activate(any(Rect.class), any(WindowContainerTransaction.class));
|
||||
verify(mSideStage).addTask(eq(task), any(Rect.class),
|
||||
|
||||
Reference in New Issue
Block a user