Merge "Implement Split to fullscreen with META+CTRL+DPAD_UP" into tm-qpr-dev am: 977d57cd5b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20059260 Change-Id: Ia07f6111f456d25decc0abfd15c16a50826e5a08 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -328,4 +328,7 @@ oneway interface IStatusBar
|
|||||||
|
|
||||||
/** Shows rear display educational dialog */
|
/** Shows rear display educational dialog */
|
||||||
void showRearDisplayDialog(int currentBaseState);
|
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. */
|
/** Called when device waking up finished. */
|
||||||
void onFinishedWakingUp();
|
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 */
|
/** Get a string representation of a stage type */
|
||||||
static String stageTypeToString(@StageType int stage) {
|
static String stageTypeToString(@StageType int stage) {
|
||||||
switch (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 = 7;
|
||||||
public static final int EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP = 8;
|
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_CHILD_TASK_ENTER_PIP = 9;
|
||||||
|
public static final int EXIT_REASON_FULLSCREEN_SHORTCUT = 10;
|
||||||
@IntDef(value = {
|
@IntDef(value = {
|
||||||
EXIT_REASON_UNKNOWN,
|
EXIT_REASON_UNKNOWN,
|
||||||
EXIT_REASON_APP_DOES_NOT_SUPPORT_MULTIWINDOW,
|
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,
|
||||||
EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP,
|
EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP,
|
||||||
EXIT_REASON_CHILD_TASK_ENTER_PIP,
|
EXIT_REASON_CHILD_TASK_ENTER_PIP,
|
||||||
|
EXIT_REASON_FULLSCREEN_SHORTCUT,
|
||||||
})
|
})
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@interface ExitReason{}
|
@interface ExitReason{}
|
||||||
@@ -418,6 +420,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
mStageCoordinator.unregisterSplitScreenListener(listener);
|
mStageCoordinator.unregisterSplitScreenListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void goToFullscreenFromSplit() {
|
||||||
|
mStageCoordinator.goToFullscreenFromSplit();
|
||||||
|
}
|
||||||
|
|
||||||
public void startTask(int taskId, @SplitPosition int position, @Nullable Bundle options) {
|
public void startTask(int taskId, @SplitPosition int position, @Nullable Bundle options) {
|
||||||
final int[] result = new int[1];
|
final int[] result = new int[1];
|
||||||
IRemoteAnimationRunner wrapper = new IRemoteAnimationRunner.Stub() {
|
IRemoteAnimationRunner wrapper = new IRemoteAnimationRunner.Stub() {
|
||||||
@@ -860,9 +866,12 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinishedWakingUp() {
|
public void onFinishedWakingUp() {
|
||||||
mMainExecutor.execute(() -> {
|
mMainExecutor.execute(SplitScreenController.this::onFinishedWakingUp);
|
||||||
SplitScreenController.this.onFinishedWakingUp();
|
}
|
||||||
});
|
|
||||||
|
@Override
|
||||||
|
public void goToFullscreenFromSplit() {
|
||||||
|
mMainExecutor.execute(SplitScreenController.this::goToFullscreenFromSplit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -918,33 +927,25 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
@Override
|
@Override
|
||||||
public void exitSplitScreen(int toTopTaskId) {
|
public void exitSplitScreen(int toTopTaskId) {
|
||||||
executeRemoteCallWithTaskPermission(mController, "exitSplitScreen",
|
executeRemoteCallWithTaskPermission(mController, "exitSplitScreen",
|
||||||
(controller) -> {
|
(controller) -> controller.exitSplitScreen(toTopTaskId, EXIT_REASON_UNKNOWN));
|
||||||
controller.exitSplitScreen(toTopTaskId, EXIT_REASON_UNKNOWN);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exitSplitScreenOnHide(boolean exitSplitScreenOnHide) {
|
public void exitSplitScreenOnHide(boolean exitSplitScreenOnHide) {
|
||||||
executeRemoteCallWithTaskPermission(mController, "exitSplitScreenOnHide",
|
executeRemoteCallWithTaskPermission(mController, "exitSplitScreenOnHide",
|
||||||
(controller) -> {
|
(controller) -> controller.exitSplitScreenOnHide(exitSplitScreenOnHide));
|
||||||
controller.exitSplitScreenOnHide(exitSplitScreenOnHide);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeFromSideStage(int taskId) {
|
public void removeFromSideStage(int taskId) {
|
||||||
executeRemoteCallWithTaskPermission(mController, "removeFromSideStage",
|
executeRemoteCallWithTaskPermission(mController, "removeFromSideStage",
|
||||||
(controller) -> {
|
(controller) -> controller.removeFromSideStage(taskId));
|
||||||
controller.removeFromSideStage(taskId);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startTask(int taskId, int position, @Nullable Bundle options) {
|
public void startTask(int taskId, int position, @Nullable Bundle options) {
|
||||||
executeRemoteCallWithTaskPermission(mController, "startTask",
|
executeRemoteCallWithTaskPermission(mController, "startTask",
|
||||||
(controller) -> {
|
(controller) -> controller.startTask(taskId, position, options));
|
||||||
controller.startTask(taskId, position, options);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1036,19 +1037,16 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
public void startShortcut(String packageName, String shortcutId, int position,
|
public void startShortcut(String packageName, String shortcutId, int position,
|
||||||
@Nullable Bundle options, UserHandle user, InstanceId instanceId) {
|
@Nullable Bundle options, UserHandle user, InstanceId instanceId) {
|
||||||
executeRemoteCallWithTaskPermission(mController, "startShortcut",
|
executeRemoteCallWithTaskPermission(mController, "startShortcut",
|
||||||
(controller) -> {
|
(controller) -> controller.startShortcut(packageName, shortcutId, position,
|
||||||
controller.startShortcut(packageName, shortcutId, position, options, user,
|
options, user, instanceId));
|
||||||
instanceId);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startIntent(PendingIntent intent, Intent fillInIntent, int position,
|
public void startIntent(PendingIntent intent, Intent fillInIntent, int position,
|
||||||
@Nullable Bundle options, InstanceId instanceId) {
|
@Nullable Bundle options, InstanceId instanceId) {
|
||||||
executeRemoteCallWithTaskPermission(mController, "startIntent",
|
executeRemoteCallWithTaskPermission(mController, "startIntent",
|
||||||
(controller) -> {
|
(controller) -> controller.startIntent(intent, fillInIntent, position, options,
|
||||||
controller.startIntent(intent, fillInIntent, position, options, instanceId);
|
instanceId));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.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_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_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_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_DEVICE_FOLDED;
|
||||||
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_DRAG_DIVIDER;
|
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.
|
* Exits the split screen by finishing one of the tasks.
|
||||||
*/
|
*/
|
||||||
protected void exitStage(@SplitPosition int stageToClose) {
|
protected void exitStage(@SplitPosition int stageToClose) {
|
||||||
if (ENABLE_SHELL_TRANSITIONS) {
|
mSplitLayout.flingDividerToDismiss(stageToClose == SPLIT_POSITION_BOTTOM_OR_RIGHT,
|
||||||
StageTaskListener stageToTop = mSideStagePosition == stageToClose
|
EXIT_REASON_APP_FINISHED);
|
||||||
? mMainStage
|
|
||||||
: mSideStage;
|
|
||||||
exitSplitScreen(stageToTop, EXIT_REASON_APP_FINISHED);
|
|
||||||
} else {
|
|
||||||
boolean toEnd = stageToClose == SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
|
||||||
mSplitLayout.flingDividerToDismiss(toEnd, EXIT_REASON_APP_FINISHED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1157,6 +1151,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
case EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP:
|
case EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP:
|
||||||
// User has unlocked the device after folded
|
// User has unlocked the device after folded
|
||||||
case EXIT_REASON_DEVICE_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;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@@ -2119,6 +2116,16 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
return true;
|
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. */
|
/** Synchronize split-screen state with transition and make appropriate preparations. */
|
||||||
public void prepareDismissAnimation(@StageType int toStage, @ExitReason int dismissReason,
|
public void prepareDismissAnimation(@StageType int toStage, @ExitReason int dismissReason,
|
||||||
@NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t,
|
@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_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_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_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_NONE = 0;
|
||||||
public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 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
|
* @see IStatusBar#showRearDisplayDialog
|
||||||
*/
|
*/
|
||||||
default void showRearDisplayDialog(int currentBaseState) {}
|
default void showRearDisplayDialog(int currentBaseState) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IStatusBar#goToFullscreenFromSplit
|
||||||
|
*/
|
||||||
|
default void goToFullscreenFromSplit() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandQueue(Context context) {
|
public CommandQueue(Context context) {
|
||||||
@@ -1302,6 +1308,11 @@ public class CommandQueue extends IStatusBar.Stub implements
|
|||||||
.sendToTarget();
|
.sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void goToFullscreenFromSplit() {
|
||||||
|
mHandler.obtainMessage(MSG_GO_TO_FULLSCREEN_FROM_SPLIT).sendToTarget();
|
||||||
|
}
|
||||||
|
|
||||||
private final class H extends Handler {
|
private final class H extends Handler {
|
||||||
private H(Looper l) {
|
private H(Looper l) {
|
||||||
super(l);
|
super(l);
|
||||||
@@ -1741,6 +1752,12 @@ public class CommandQueue extends IStatusBar.Stub implements
|
|||||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||||
mCallbacks.get(i).showRearDisplayDialog((Integer) msg.obj);
|
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();
|
splitScreen.onFinishedWakingUp();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
mCommandQueue.addCallback(new CommandQueue.Callbacks() {
|
||||||
|
@Override
|
||||||
|
public void goToFullscreenFromSplit() {
|
||||||
|
splitScreen.goToFullscreenFromSplit();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
|||||||
@@ -2867,6 +2867,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
return key_consumed;
|
return key_consumed;
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case KeyEvent.KEYCODE_SLASH:
|
||||||
if (down && repeatCount == 0 && event.isMetaPressed() && !keyguardOn) {
|
if (down && repeatCount == 0 && event.isMetaPressed() && !keyguardOn) {
|
||||||
toggleKeyboardShortcutsMenu(event.getDeviceId());
|
toggleKeyboardShortcutsMenu(event.getDeviceId());
|
||||||
|
|||||||
@@ -179,4 +179,9 @@ public interface StatusBarManagerInternal {
|
|||||||
* @see com.android.internal.statusbar.IStatusBar#showRearDisplayDialog
|
* @see com.android.internal.statusbar.IStatusBar#showRearDisplayDialog
|
||||||
*/
|
*/
|
||||||
void showRearDisplayDialog(int currentBaseState);
|
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) { }
|
} catch (RemoteException ex) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void goToFullscreenFromSplit() {
|
||||||
|
if (mBar != null) {
|
||||||
|
try {
|
||||||
|
mBar.goToFullscreenFromSplit();
|
||||||
|
} catch (RemoteException ex) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final GlobalActionsProvider mGlobalActionsProvider = new GlobalActionsProvider() {
|
private final GlobalActionsProvider mGlobalActionsProvider = new GlobalActionsProvider() {
|
||||||
|
|||||||
Reference in New Issue
Block a user