Map split from the current running app to META+CTRL+DPAD_LEFT and META+CTRL+DPAD_RIGHT

Fixes: 246661484
Test: https://recall.googleplex.com/projects/f4cc906f-d337-414e-aea8-d5434a0c6e88/sessions/06cc05b5-c032-40f3-af8b-3b90860d2f37
Change-Id: I8b293a0eb7e198fc2ff25c4c5a57dbd58f6be2f4
This commit is contained in:
Tracy Zhou
2022-12-01 03:54:31 +00:00
parent e1b6a5d843
commit c6ab679af3
6 changed files with 74 additions and 1 deletions

View File

@@ -330,4 +330,11 @@ oneway interface IStatusBar
/** Called when requested to go to fullscreen from the active split app. */
void goToFullscreenFromSplit();
/**
* Enters stage split from a current running app.
*
* @param leftOrTop indicates where the stage split is.
*/
void enterStageSplitFromRunningApp(boolean leftOrTop);
}

View File

@@ -565,13 +565,25 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
statusBarWinController.registerCallback(mStatusBarWindowCallback);
mScreenshotHelper = new ScreenshotHelper(context);
// Listen for tracing state changes
commandQueue.addCallback(new CommandQueue.Callbacks() {
// Listen for tracing state changes
@Override
public void onTracingStateChanged(boolean enabled) {
mSysUiState.setFlag(SYSUI_STATE_TRACING_ENABLED, enabled)
.commitUpdate(mContext.getDisplayId());
}
@Override
public void enterStageSplitFromRunningApp(boolean leftOrTop) {
if (mOverviewProxy != null) {
try {
mOverviewProxy.enterStageSplitFromRunningApp(leftOrTop);
} catch (RemoteException e) {
Log.w(TAG_OPS, "Unable to enter stage split from the current running app");
}
}
}
});
mCommandQueue = commandQueue;

View File

@@ -165,6 +165,7 @@ public class CommandQueue extends IStatusBar.Stub implements
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;
private static final int MSG_ENTER_STAGE_SPLIT_FROM_RUNNING_APP = 71 << MSG_SHIFT;
public static final int FLAG_EXCLUDE_NONE = 0;
public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
@@ -484,6 +485,11 @@ public class CommandQueue extends IStatusBar.Stub implements
* @see IStatusBar#goToFullscreenFromSplit
*/
default void goToFullscreenFromSplit() {}
/**
* @see IStatusBar#enterStageSplitFromRunningApp
*/
default void enterStageSplitFromRunningApp(boolean leftOrTop) {}
}
public CommandQueue(Context context) {
@@ -1244,6 +1250,14 @@ public class CommandQueue extends IStatusBar.Stub implements
}
}
@Override
public void enterStageSplitFromRunningApp(boolean leftOrTop) {
synchronized (mLock) {
mHandler.obtainMessage(MSG_ENTER_STAGE_SPLIT_FROM_RUNNING_APP,
leftOrTop).sendToTarget();
}
}
@Override
public void requestAddTile(
@NonNull ComponentName componentName,
@@ -1755,6 +1769,11 @@ public class CommandQueue extends IStatusBar.Stub implements
mCallbacks.get(i).goToFullscreenFromSplit();
}
break;
case MSG_ENTER_STAGE_SPLIT_FROM_RUNNING_APP:
for (int i = 0; i < mCallbacks.size(); i++) {
mCallbacks.get(i).enterStageSplitFromRunningApp((Boolean) msg.obj);
}
break;
}
}
}

View File

@@ -2929,6 +2929,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return key_consumed;
}
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
if (down && event.isMetaPressed() && event.isCtrlPressed() && repeatCount == 0) {
enterStageSplitFromRunningApp(true /* leftOrTop */);
return key_consumed;
}
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
if (down && event.isMetaPressed() && event.isCtrlPressed() && repeatCount == 0) {
enterStageSplitFromRunningApp(false /* leftOrTop */);
return key_consumed;
}
break;
case KeyEvent.KEYCODE_SLASH:
if (down && repeatCount == 0 && event.isMetaPressed() && !keyguardOn) {
toggleKeyboardShortcutsMenu(event.getDeviceId());
@@ -3583,6 +3595,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
private void enterStageSplitFromRunningApp(boolean leftOrTop) {
StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
if (statusbar != null) {
statusbar.enterStageSplitFromRunningApp(leftOrTop);
}
}
void launchHomeFromHotKey(int displayId) {
launchHomeFromHotKey(displayId, true /* awakenFromDreams */, true /*respectKeyguard*/);
}

View File

@@ -210,4 +210,11 @@ public interface StatusBarManagerInternal {
* Called when requested to go to fullscreen from the active split app.
*/
void goToFullscreenFromSplit();
/**
* Enters stage split from a current running app.
*
* @see com.android.internal.statusbar.IStatusBar#enterStageSplitFromRunningApp
*/
void enterStageSplitFromRunningApp(boolean leftOrTop);
}

View File

@@ -735,6 +735,15 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
} catch (RemoteException ex) { }
}
}
@Override
public void enterStageSplitFromRunningApp(boolean leftOrTop) {
if (mBar != null) {
try {
mBar.enterStageSplitFromRunningApp(leftOrTop);
} catch (RemoteException ex) { }
}
}
};
private final GlobalActionsProvider mGlobalActionsProvider = new GlobalActionsProvider() {