Implement Split to fullscreen with META+CTRL+DPAD_UP
Bug: 246661489 Test: https://recall.googleplex.com/projects/f4cc906f-d337-414e-aea8-d5434a0c6e88/sessions/77b9b268-4abb-4703-af72-fc0412f7312e Change-Id: Ie68e2c8a83879d3a9e91baea0be68e14d5dd9604
This commit is contained in:
@@ -328,4 +328,7 @@ oneway interface IStatusBar
|
||||
|
||||
/** Shows rear display educational dialog */
|
||||
void showRearDisplayDialog(int currentBaseState);
|
||||
|
||||
/** Called when requested to go to fullscreen from the active split app. */
|
||||
void goToFullscreenFromSplit();
|
||||
}
|
||||
|
||||
@@ -73,6 +73,9 @@ public interface SplitScreen {
|
||||
/** Called when device waking up finished. */
|
||||
void onFinishedWakingUp();
|
||||
|
||||
/** Called when requested to go to fullscreen from the current active split app. */
|
||||
void goToFullscreenFromSplit();
|
||||
|
||||
/** Get a string representation of a stage type */
|
||||
static String stageTypeToString(@StageType int stage) {
|
||||
switch (stage) {
|
||||
|
||||
@@ -123,6 +123,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
public static final int EXIT_REASON_SCREEN_LOCKED = 7;
|
||||
public static final int EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP = 8;
|
||||
public static final int EXIT_REASON_CHILD_TASK_ENTER_PIP = 9;
|
||||
public static final int EXIT_REASON_FULLSCREEN_SHORTCUT = 10;
|
||||
@IntDef(value = {
|
||||
EXIT_REASON_UNKNOWN,
|
||||
EXIT_REASON_APP_DOES_NOT_SUPPORT_MULTIWINDOW,
|
||||
@@ -134,6 +135,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
EXIT_REASON_SCREEN_LOCKED,
|
||||
EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP,
|
||||
EXIT_REASON_CHILD_TASK_ENTER_PIP,
|
||||
EXIT_REASON_FULLSCREEN_SHORTCUT,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@interface ExitReason{}
|
||||
@@ -418,6 +420,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
mStageCoordinator.unregisterSplitScreenListener(listener);
|
||||
}
|
||||
|
||||
public void goToFullscreenFromSplit() {
|
||||
mStageCoordinator.goToFullscreenFromSplit();
|
||||
}
|
||||
|
||||
public void startTask(int taskId, @SplitPosition int position, @Nullable Bundle options) {
|
||||
final int[] result = new int[1];
|
||||
IRemoteAnimationRunner wrapper = new IRemoteAnimationRunner.Stub() {
|
||||
@@ -860,9 +866,12 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
|
||||
@Override
|
||||
public void onFinishedWakingUp() {
|
||||
mMainExecutor.execute(() -> {
|
||||
SplitScreenController.this.onFinishedWakingUp();
|
||||
});
|
||||
mMainExecutor.execute(SplitScreenController.this::onFinishedWakingUp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToFullscreenFromSplit() {
|
||||
mMainExecutor.execute(SplitScreenController.this::goToFullscreenFromSplit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -918,33 +927,25 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
@Override
|
||||
public void exitSplitScreen(int toTopTaskId) {
|
||||
executeRemoteCallWithTaskPermission(mController, "exitSplitScreen",
|
||||
(controller) -> {
|
||||
controller.exitSplitScreen(toTopTaskId, EXIT_REASON_UNKNOWN);
|
||||
});
|
||||
(controller) -> controller.exitSplitScreen(toTopTaskId, EXIT_REASON_UNKNOWN));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitSplitScreenOnHide(boolean exitSplitScreenOnHide) {
|
||||
executeRemoteCallWithTaskPermission(mController, "exitSplitScreenOnHide",
|
||||
(controller) -> {
|
||||
controller.exitSplitScreenOnHide(exitSplitScreenOnHide);
|
||||
});
|
||||
(controller) -> controller.exitSplitScreenOnHide(exitSplitScreenOnHide));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromSideStage(int taskId) {
|
||||
executeRemoteCallWithTaskPermission(mController, "removeFromSideStage",
|
||||
(controller) -> {
|
||||
controller.removeFromSideStage(taskId);
|
||||
});
|
||||
(controller) -> controller.removeFromSideStage(taskId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startTask(int taskId, int position, @Nullable Bundle options) {
|
||||
executeRemoteCallWithTaskPermission(mController, "startTask",
|
||||
(controller) -> {
|
||||
controller.startTask(taskId, position, options);
|
||||
});
|
||||
(controller) -> controller.startTask(taskId, position, options));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1036,19 +1037,16 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
public void startShortcut(String packageName, String shortcutId, int position,
|
||||
@Nullable Bundle options, UserHandle user, InstanceId instanceId) {
|
||||
executeRemoteCallWithTaskPermission(mController, "startShortcut",
|
||||
(controller) -> {
|
||||
controller.startShortcut(packageName, shortcutId, position, options, user,
|
||||
instanceId);
|
||||
});
|
||||
(controller) -> controller.startShortcut(packageName, shortcutId, position,
|
||||
options, user, instanceId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startIntent(PendingIntent intent, Intent fillInIntent, int position,
|
||||
@Nullable Bundle options, InstanceId instanceId) {
|
||||
executeRemoteCallWithTaskPermission(mController, "startIntent",
|
||||
(controller) -> {
|
||||
controller.startIntent(intent, fillInIntent, position, options, instanceId);
|
||||
});
|
||||
(controller) -> controller.startIntent(intent, fillInIntent, position, options,
|
||||
instanceId));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,6 +49,7 @@ import static com.android.wm.shell.splitscreen.SplitScreenController.ENTER_REASO
|
||||
import static com.android.wm.shell.splitscreen.SplitScreenController.ENTER_REASON_MULTI_INSTANCE;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_APP_DOES_NOT_SUPPORT_MULTIWINDOW;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_APP_FINISHED;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_FULLSCREEN_SHORTCUT;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_CHILD_TASK_ENTER_PIP;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_DEVICE_FOLDED;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_DRAG_DIVIDER;
|
||||
@@ -1115,15 +1116,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
* Exits the split screen by finishing one of the tasks.
|
||||
*/
|
||||
protected void exitStage(@SplitPosition int stageToClose) {
|
||||
if (ENABLE_SHELL_TRANSITIONS) {
|
||||
StageTaskListener stageToTop = mSideStagePosition == stageToClose
|
||||
? mMainStage
|
||||
: mSideStage;
|
||||
exitSplitScreen(stageToTop, EXIT_REASON_APP_FINISHED);
|
||||
} else {
|
||||
boolean toEnd = stageToClose == SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
||||
mSplitLayout.flingDividerToDismiss(toEnd, EXIT_REASON_APP_FINISHED);
|
||||
}
|
||||
mSplitLayout.flingDividerToDismiss(stageToClose == SPLIT_POSITION_BOTTOM_OR_RIGHT,
|
||||
EXIT_REASON_APP_FINISHED);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1157,6 +1151,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
case EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP:
|
||||
// User has unlocked the device after folded
|
||||
case EXIT_REASON_DEVICE_FOLDED:
|
||||
// The device is folded
|
||||
case EXIT_REASON_FULLSCREEN_SHORTCUT:
|
||||
// User has used a keyboard shortcut to go back to fullscreen from split
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -2119,6 +2116,16 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
return true;
|
||||
}
|
||||
|
||||
public void goToFullscreenFromSplit() {
|
||||
boolean leftOrTop;
|
||||
if (mSideStage.isFocused()) {
|
||||
leftOrTop = (mSideStagePosition == SPLIT_POSITION_TOP_OR_LEFT);
|
||||
} else {
|
||||
leftOrTop = (mSideStagePosition == SPLIT_POSITION_BOTTOM_OR_RIGHT);
|
||||
}
|
||||
mSplitLayout.flingDividerToDismiss(!leftOrTop, EXIT_REASON_FULLSCREEN_SHORTCUT);
|
||||
}
|
||||
|
||||
/** Synchronize split-screen state with transition and make appropriate preparations. */
|
||||
public void prepareDismissAnimation(@StageType int toStage, @ExitReason int dismissReason,
|
||||
@NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t,
|
||||
|
||||
@@ -166,6 +166,7 @@ public class CommandQueue extends IStatusBar.Stub implements
|
||||
private static final int MSG_UNREGISTER_NEARBY_MEDIA_DEVICE_PROVIDER = 67 << MSG_SHIFT;
|
||||
private static final int MSG_TILE_SERVICE_REQUEST_LISTENING_STATE = 68 << MSG_SHIFT;
|
||||
private static final int MSG_SHOW_REAR_DISPLAY_DIALOG = 69 << MSG_SHIFT;
|
||||
private static final int MSG_GO_TO_FULLSCREEN_FROM_SPLIT = 70 << MSG_SHIFT;
|
||||
|
||||
public static final int FLAG_EXCLUDE_NONE = 0;
|
||||
public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
|
||||
@@ -480,6 +481,11 @@ public class CommandQueue extends IStatusBar.Stub implements
|
||||
* @see IStatusBar#showRearDisplayDialog
|
||||
*/
|
||||
default void showRearDisplayDialog(int currentBaseState) {}
|
||||
|
||||
/**
|
||||
* @see IStatusBar#goToFullscreenFromSplit
|
||||
*/
|
||||
default void goToFullscreenFromSplit() {}
|
||||
}
|
||||
|
||||
public CommandQueue(Context context) {
|
||||
@@ -1302,6 +1308,11 @@ public class CommandQueue extends IStatusBar.Stub implements
|
||||
.sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToFullscreenFromSplit() {
|
||||
mHandler.obtainMessage(MSG_GO_TO_FULLSCREEN_FROM_SPLIT).sendToTarget();
|
||||
}
|
||||
|
||||
private final class H extends Handler {
|
||||
private H(Looper l) {
|
||||
super(l);
|
||||
@@ -1741,6 +1752,12 @@ public class CommandQueue extends IStatusBar.Stub implements
|
||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||
mCallbacks.get(i).showRearDisplayDialog((Integer) msg.obj);
|
||||
}
|
||||
break;
|
||||
case MSG_GO_TO_FULLSCREEN_FROM_SPLIT:
|
||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||
mCallbacks.get(i).goToFullscreenFromSplit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,6 +253,12 @@ public final class WMShell implements
|
||||
splitScreen.onFinishedWakingUp();
|
||||
}
|
||||
});
|
||||
mCommandQueue.addCallback(new CommandQueue.Callbacks() {
|
||||
@Override
|
||||
public void goToFullscreenFromSplit() {
|
||||
splitScreen.goToFullscreenFromSplit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -2864,6 +2864,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
return key_consumed;
|
||||
}
|
||||
break;
|
||||
case KeyEvent.KEYCODE_DPAD_UP:
|
||||
if (down && event.isMetaPressed() && event.isCtrlPressed() && repeatCount == 0) {
|
||||
StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
|
||||
if (statusbar != null) {
|
||||
statusbar.goToFullscreenFromSplit();
|
||||
}
|
||||
return key_consumed;
|
||||
}
|
||||
break;
|
||||
case KeyEvent.KEYCODE_SLASH:
|
||||
if (down && repeatCount == 0 && event.isMetaPressed() && !keyguardOn) {
|
||||
toggleKeyboardShortcutsMenu(event.getDeviceId());
|
||||
|
||||
@@ -179,4 +179,9 @@ public interface StatusBarManagerInternal {
|
||||
* @see com.android.internal.statusbar.IStatusBar#showRearDisplayDialog
|
||||
*/
|
||||
void showRearDisplayDialog(int currentBaseState);
|
||||
|
||||
/**
|
||||
* Called when requested to go to fullscreen from the active split app.
|
||||
*/
|
||||
void goToFullscreenFromSplit();
|
||||
}
|
||||
|
||||
@@ -696,6 +696,15 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
|
||||
} catch (RemoteException ex) { }
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToFullscreenFromSplit() {
|
||||
if (mBar != null) {
|
||||
try {
|
||||
mBar.goToFullscreenFromSplit();
|
||||
} catch (RemoteException ex) { }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final GlobalActionsProvider mGlobalActionsProvider = new GlobalActionsProvider() {
|
||||
|
||||
Reference in New Issue
Block a user