Loading libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragAndDropPolicy.java +13 −25 Original line number Diff line number Diff line Loading @@ -37,8 +37,6 @@ import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPL 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_TYPE_SIDE; import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_UNDEFINED; import android.app.ActivityManager; import android.app.ActivityTaskManager; Loading Loading @@ -66,7 +64,6 @@ import androidx.annotation.VisibleForTesting; import com.android.internal.logging.InstanceId; import com.android.wm.shell.common.DisplayLayout; import com.android.wm.shell.common.split.SplitLayout.SplitPosition; import com.android.wm.shell.splitscreen.SplitScreen.StageType; import com.android.wm.shell.splitscreen.SplitScreenController; import java.lang.annotation.Retention; Loading Loading @@ -198,29 +195,23 @@ public class DragAndDropPolicy { return; } final boolean inSplitScreen = mSplitScreen != null && mSplitScreen.isSplitScreenVisible(); final boolean leftOrTop = target.type == TYPE_SPLIT_TOP || target.type == TYPE_SPLIT_LEFT; @StageType int stage = STAGE_TYPE_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 ? 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; } // Add some data for logging splitscreen once it is invoked mSplitScreen.logOnDroppedToSplit(position, mLoggerSessionId); } final ClipDescription description = data.getDescription(); final Intent dragData = mSession.dragData; startClipDescription(description, dragData, stage, position); startClipDescription(description, dragData, position); } private void startClipDescription(ClipDescription description, Intent intent, @StageType int stage, @SplitPosition int position) { @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) Loading @@ -228,15 +219,15 @@ public class DragAndDropPolicy { if (isTask) { final int taskId = intent.getIntExtra(EXTRA_TASK_ID, INVALID_TASK_ID); mStarter.startTask(taskId, stage, position, opts); mStarter.startTask(taskId, position, opts); } else if (isShortcut) { final String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME); final String id = intent.getStringExtra(EXTRA_SHORTCUT_ID); final UserHandle user = intent.getParcelableExtra(EXTRA_USER); mStarter.startShortcut(packageName, id, stage, position, opts, user); mStarter.startShortcut(packageName, id, position, opts, user); } else { mStarter.startIntent(intent.getParcelableExtra(EXTRA_PENDING_INTENT), null, stage, position, opts); null, position, opts); } } Loading Loading @@ -291,12 +282,10 @@ public class DragAndDropPolicy { * Interface for actually committing the task launches. */ public interface Starter { void startTask(int taskId, @StageType int stage, @SplitPosition int position, @Nullable Bundle options); void startShortcut(String packageName, String shortcutId, @StageType int stage, @SplitPosition int position, @Nullable Bundle options, UserHandle user); void startIntent(PendingIntent intent, Intent fillInIntent, @StageType int stage, @SplitPosition int position, void startTask(int taskId, @SplitPosition int position, @Nullable Bundle options); void startShortcut(String packageName, String shortcutId, @SplitPosition int position, @Nullable Bundle options, UserHandle user); void startIntent(PendingIntent intent, Intent fillInIntent, @SplitPosition int position, @Nullable Bundle options); void enterSplitScreen(int taskId, boolean leftOrTop); Loading @@ -319,8 +308,7 @@ public class DragAndDropPolicy { } @Override public void startTask(int taskId, int stage, int position, @Nullable Bundle options) { public void startTask(int taskId, int position, @Nullable Bundle options) { try { ActivityTaskManager.getService().startActivityFromRecents(taskId, options); } catch (RemoteException e) { Loading @@ -329,7 +317,7 @@ public class DragAndDropPolicy { } @Override public void startShortcut(String packageName, String shortcutId, int stage, int position, public void startShortcut(String packageName, String shortcutId, int position, @Nullable Bundle options, UserHandle user) { try { LauncherApps launcherApps = Loading @@ -342,8 +330,8 @@ public class DragAndDropPolicy { } @Override public void startIntent(PendingIntent intent, @Nullable Intent fillInIntent, int stage, int position, @Nullable Bundle options) { public void startIntent(PendingIntent intent, @Nullable Intent fillInIntent, int position, @Nullable Bundle options) { try { intent.send(mContext, 0, fillInIntent, null, null, null, options); } catch (PendingIntent.CanceledException e) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl +4 −4 Original line number Diff line number Diff line Loading @@ -65,19 +65,19 @@ interface ISplitScreen { /** * Starts a task in a stage. */ oneway void startTask(int taskId, int stage, int position, in Bundle options) = 7; oneway void startTask(int taskId, int position, in Bundle options) = 7; /** * Starts a shortcut in a stage. */ oneway void startShortcut(String packageName, String shortcutId, int stage, int position, oneway void startShortcut(String packageName, String shortcutId, int position, in Bundle options, in UserHandle user) = 8; /** * Starts an activity in a stage. */ oneway void startIntent(in PendingIntent intent, in Intent fillInIntent, int stage, int position, in Bundle options) = 9; oneway void startIntent(in PendingIntent intent, in Intent fillInIntent, int position, in Bundle options) = 9; /** * Starts tasks simultaneously in one transition. Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +17 −20 Original line number Diff line number Diff line Loading @@ -265,9 +265,9 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, mStageCoordinator.unregisterSplitScreenListener(listener); } public void startTask(int taskId, @SplitScreen.StageType int stage, @SplitPosition int position, @Nullable Bundle options) { options = mStageCoordinator.resolveStartStage(stage, position, options, null /* wct */); public void startTask(int taskId, @SplitPosition int position, @Nullable Bundle options) { options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options, null /* wct */); try { final WindowContainerTransaction evictWct = new WindowContainerTransaction(); Loading @@ -282,10 +282,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } } public void startShortcut(String packageName, String shortcutId, @SplitScreen.StageType int stage, @SplitPosition int position, public void startShortcut(String packageName, String shortcutId, @SplitPosition int position, @Nullable Bundle options, UserHandle user) { options = mStageCoordinator.resolveStartStage(stage, position, options, null /* wct */); options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options, null /* wct */); final WindowContainerTransaction evictWct = new WindowContainerTransaction(); mStageCoordinator.prepareEvictChildTasks(position, evictWct); Loading @@ -300,20 +300,18 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } } public void startIntent(PendingIntent intent, Intent fillInIntent, @SplitScreen.StageType int stage, @SplitPosition int position, public void startIntent(PendingIntent intent, Intent fillInIntent, @SplitPosition int position, @Nullable Bundle options) { if (!Transitions.ENABLE_SHELL_TRANSITIONS) { startIntentLegacy(intent, fillInIntent, stage, position, options); startIntentLegacy(intent, fillInIntent, position, options); return; } mStageCoordinator.startIntent(intent, fillInIntent, stage, position, options, mStageCoordinator.startIntent(intent, fillInIntent, STAGE_TYPE_UNDEFINED, position, options, null /* remote */); } private void startIntentLegacy(PendingIntent intent, Intent fillInIntent, @SplitScreen.StageType int stage, @SplitPosition int position, @Nullable Bundle options) { @SplitPosition int position, @Nullable Bundle options) { final WindowContainerTransaction evictWct = new WindowContainerTransaction(); mStageCoordinator.prepareEvictChildTasks(position, evictWct); Loading Loading @@ -347,7 +345,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, }; final WindowContainerTransaction wct = new WindowContainerTransaction(); options = mStageCoordinator.resolveStartStage(stage, position, options, wct); options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options, wct); wct.sendPendingIntent(intent, fillInIntent, options); mSyncQueue.queue(transition, WindowManager.TRANSIT_OPEN, wct); } Loading Loading @@ -604,10 +602,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } @Override public void startTask(int taskId, int stage, int position, @Nullable Bundle options) { public void startTask(int taskId, int position, @Nullable Bundle options) { executeRemoteCallWithTaskPermission(mController, "startTask", (controller) -> { controller.startTask(taskId, stage, position, options); controller.startTask(taskId, position, options); }); } Loading @@ -632,21 +630,20 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } @Override public void startShortcut(String packageName, String shortcutId, int stage, int position, public void startShortcut(String packageName, String shortcutId, int position, @Nullable Bundle options, UserHandle user) { executeRemoteCallWithTaskPermission(mController, "startShortcut", (controller) -> { controller.startShortcut(packageName, shortcutId, stage, position, options, user); controller.startShortcut(packageName, shortcutId, position, options, user); }); } @Override public void startIntent(PendingIntent intent, Intent fillInIntent, int stage, int position, public void startIntent(PendingIntent intent, Intent fillInIntent, int position, @Nullable Bundle options) { executeRemoteCallWithTaskPermission(mController, "startIntent", (controller) -> { controller.startIntent(intent, fillInIntent, stage, position, options); controller.startIntent(intent, fillInIntent, position, options); }); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +7 −4 Original line number Diff line number Diff line Loading @@ -462,12 +462,15 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, @androidx.annotation.Nullable WindowContainerTransaction wct) { switch (stage) { case STAGE_TYPE_UNDEFINED: { // Use the stage of the specified position is valid. if (position != SPLIT_POSITION_UNDEFINED) { if (position == getSideStagePosition()) { options = resolveStartStage(STAGE_TYPE_SIDE, position, options, wct); if (mMainStage.isActive()) { // Use the stage of the specified position options = resolveStartStage( position == mSideStagePosition ? STAGE_TYPE_SIDE : STAGE_TYPE_MAIN, position, options, wct); } else { options = resolveStartStage(STAGE_TYPE_MAIN, position, options, wct); // Use the side stage as default to active split screen options = resolveStartStage(STAGE_TYPE_SIDE, position, options, wct); } } else { // Exit split-screen and launch fullscreen since stage wasn't specified. Loading libs/WindowManager/Shell/src/com/android/wm/shell/stagesplit/SplitScreenController.java +15 −16 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.view.RemoteAnimationTarget.MODE_OPENING; import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission; 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_UNDEFINED; import android.app.ActivityManager; import android.app.ActivityTaskManager; Loading Loading @@ -208,9 +209,9 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, mStageCoordinator.unregisterSplitScreenListener(listener); } public void startTask(int taskId, @SplitScreen.StageType int stage, @SplitPosition int position, @Nullable Bundle options) { options = mStageCoordinator.resolveStartStage(stage, position, options, null /* wct */); public void startTask(int taskId, @SplitPosition int position, @Nullable Bundle options) { options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options, null /* wct */); try { ActivityTaskManager.getService().startActivityFromRecents(taskId, options); Loading @@ -219,10 +220,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } } public void startShortcut(String packageName, String shortcutId, @SplitScreen.StageType int stage, @SplitPosition int position, public void startShortcut(String packageName, String shortcutId, @SplitPosition int position, @Nullable Bundle options, UserHandle user) { options = mStageCoordinator.resolveStartStage(stage, position, options, null /* wct */); options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options, null /* wct */); try { LauncherApps launcherApps = Loading @@ -234,20 +235,18 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } } public void startIntent(PendingIntent intent, Intent fillInIntent, @SplitScreen.StageType int stage, @SplitPosition int position, public void startIntent(PendingIntent intent, Intent fillInIntent, @SplitPosition int position, @Nullable Bundle options) { if (!Transitions.ENABLE_SHELL_TRANSITIONS) { startIntentLegacy(intent, fillInIntent, stage, position, options); startIntentLegacy(intent, fillInIntent, position, options); return; } mStageCoordinator.startIntent(intent, fillInIntent, stage, position, options, mStageCoordinator.startIntent(intent, fillInIntent, STAGE_TYPE_UNDEFINED, position, options, null /* remote */); } private void startIntentLegacy(PendingIntent intent, Intent fillInIntent, @SplitScreen.StageType int stage, @SplitPosition int position, @Nullable Bundle options) { @SplitPosition int position, @Nullable Bundle options) { LegacyTransitions.ILegacyTransition transition = new LegacyTransitions.ILegacyTransition() { @Override public void onAnimationStart(int transit, RemoteAnimationTarget[] apps, Loading Loading @@ -275,7 +274,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } }; WindowContainerTransaction wct = new WindowContainerTransaction(); options = mStageCoordinator.resolveStartStage(stage, position, options, wct); options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options, wct); wct.sendPendingIntent(intent, fillInIntent, options); mSyncQueue.queue(transition, WindowManager.TRANSIT_OPEN, wct); } Loading Loading @@ -539,7 +538,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, public void startTask(int taskId, int stage, int position, @Nullable Bundle options) { executeRemoteCallWithTaskPermission(mController, "startTask", (controller) -> { controller.startTask(taskId, stage, position, options); controller.startTask(taskId, position, options); }); } Loading Loading @@ -568,7 +567,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, @Nullable Bundle options, UserHandle user) { executeRemoteCallWithTaskPermission(mController, "startShortcut", (controller) -> { controller.startShortcut(packageName, shortcutId, stage, position, controller.startShortcut(packageName, shortcutId, position, options, user); }); } Loading @@ -578,7 +577,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, @Nullable Bundle options) { executeRemoteCallWithTaskPermission(mController, "startIntent", (controller) -> { controller.startIntent(intent, fillInIntent, stage, position, options); controller.startIntent(intent, fillInIntent, position, options); }); } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragAndDropPolicy.java +13 −25 Original line number Diff line number Diff line Loading @@ -37,8 +37,6 @@ import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPL 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_TYPE_SIDE; import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_UNDEFINED; import android.app.ActivityManager; import android.app.ActivityTaskManager; Loading Loading @@ -66,7 +64,6 @@ import androidx.annotation.VisibleForTesting; import com.android.internal.logging.InstanceId; import com.android.wm.shell.common.DisplayLayout; import com.android.wm.shell.common.split.SplitLayout.SplitPosition; import com.android.wm.shell.splitscreen.SplitScreen.StageType; import com.android.wm.shell.splitscreen.SplitScreenController; import java.lang.annotation.Retention; Loading Loading @@ -198,29 +195,23 @@ public class DragAndDropPolicy { return; } final boolean inSplitScreen = mSplitScreen != null && mSplitScreen.isSplitScreenVisible(); final boolean leftOrTop = target.type == TYPE_SPLIT_TOP || target.type == TYPE_SPLIT_LEFT; @StageType int stage = STAGE_TYPE_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 ? 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; } // Add some data for logging splitscreen once it is invoked mSplitScreen.logOnDroppedToSplit(position, mLoggerSessionId); } final ClipDescription description = data.getDescription(); final Intent dragData = mSession.dragData; startClipDescription(description, dragData, stage, position); startClipDescription(description, dragData, position); } private void startClipDescription(ClipDescription description, Intent intent, @StageType int stage, @SplitPosition int position) { @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) Loading @@ -228,15 +219,15 @@ public class DragAndDropPolicy { if (isTask) { final int taskId = intent.getIntExtra(EXTRA_TASK_ID, INVALID_TASK_ID); mStarter.startTask(taskId, stage, position, opts); mStarter.startTask(taskId, position, opts); } else if (isShortcut) { final String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME); final String id = intent.getStringExtra(EXTRA_SHORTCUT_ID); final UserHandle user = intent.getParcelableExtra(EXTRA_USER); mStarter.startShortcut(packageName, id, stage, position, opts, user); mStarter.startShortcut(packageName, id, position, opts, user); } else { mStarter.startIntent(intent.getParcelableExtra(EXTRA_PENDING_INTENT), null, stage, position, opts); null, position, opts); } } Loading Loading @@ -291,12 +282,10 @@ public class DragAndDropPolicy { * Interface for actually committing the task launches. */ public interface Starter { void startTask(int taskId, @StageType int stage, @SplitPosition int position, @Nullable Bundle options); void startShortcut(String packageName, String shortcutId, @StageType int stage, @SplitPosition int position, @Nullable Bundle options, UserHandle user); void startIntent(PendingIntent intent, Intent fillInIntent, @StageType int stage, @SplitPosition int position, void startTask(int taskId, @SplitPosition int position, @Nullable Bundle options); void startShortcut(String packageName, String shortcutId, @SplitPosition int position, @Nullable Bundle options, UserHandle user); void startIntent(PendingIntent intent, Intent fillInIntent, @SplitPosition int position, @Nullable Bundle options); void enterSplitScreen(int taskId, boolean leftOrTop); Loading @@ -319,8 +308,7 @@ public class DragAndDropPolicy { } @Override public void startTask(int taskId, int stage, int position, @Nullable Bundle options) { public void startTask(int taskId, int position, @Nullable Bundle options) { try { ActivityTaskManager.getService().startActivityFromRecents(taskId, options); } catch (RemoteException e) { Loading @@ -329,7 +317,7 @@ public class DragAndDropPolicy { } @Override public void startShortcut(String packageName, String shortcutId, int stage, int position, public void startShortcut(String packageName, String shortcutId, int position, @Nullable Bundle options, UserHandle user) { try { LauncherApps launcherApps = Loading @@ -342,8 +330,8 @@ public class DragAndDropPolicy { } @Override public void startIntent(PendingIntent intent, @Nullable Intent fillInIntent, int stage, int position, @Nullable Bundle options) { public void startIntent(PendingIntent intent, @Nullable Intent fillInIntent, int position, @Nullable Bundle options) { try { intent.send(mContext, 0, fillInIntent, null, null, null, options); } catch (PendingIntent.CanceledException e) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl +4 −4 Original line number Diff line number Diff line Loading @@ -65,19 +65,19 @@ interface ISplitScreen { /** * Starts a task in a stage. */ oneway void startTask(int taskId, int stage, int position, in Bundle options) = 7; oneway void startTask(int taskId, int position, in Bundle options) = 7; /** * Starts a shortcut in a stage. */ oneway void startShortcut(String packageName, String shortcutId, int stage, int position, oneway void startShortcut(String packageName, String shortcutId, int position, in Bundle options, in UserHandle user) = 8; /** * Starts an activity in a stage. */ oneway void startIntent(in PendingIntent intent, in Intent fillInIntent, int stage, int position, in Bundle options) = 9; oneway void startIntent(in PendingIntent intent, in Intent fillInIntent, int position, in Bundle options) = 9; /** * Starts tasks simultaneously in one transition. Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +17 −20 Original line number Diff line number Diff line Loading @@ -265,9 +265,9 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, mStageCoordinator.unregisterSplitScreenListener(listener); } public void startTask(int taskId, @SplitScreen.StageType int stage, @SplitPosition int position, @Nullable Bundle options) { options = mStageCoordinator.resolveStartStage(stage, position, options, null /* wct */); public void startTask(int taskId, @SplitPosition int position, @Nullable Bundle options) { options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options, null /* wct */); try { final WindowContainerTransaction evictWct = new WindowContainerTransaction(); Loading @@ -282,10 +282,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } } public void startShortcut(String packageName, String shortcutId, @SplitScreen.StageType int stage, @SplitPosition int position, public void startShortcut(String packageName, String shortcutId, @SplitPosition int position, @Nullable Bundle options, UserHandle user) { options = mStageCoordinator.resolveStartStage(stage, position, options, null /* wct */); options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options, null /* wct */); final WindowContainerTransaction evictWct = new WindowContainerTransaction(); mStageCoordinator.prepareEvictChildTasks(position, evictWct); Loading @@ -300,20 +300,18 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } } public void startIntent(PendingIntent intent, Intent fillInIntent, @SplitScreen.StageType int stage, @SplitPosition int position, public void startIntent(PendingIntent intent, Intent fillInIntent, @SplitPosition int position, @Nullable Bundle options) { if (!Transitions.ENABLE_SHELL_TRANSITIONS) { startIntentLegacy(intent, fillInIntent, stage, position, options); startIntentLegacy(intent, fillInIntent, position, options); return; } mStageCoordinator.startIntent(intent, fillInIntent, stage, position, options, mStageCoordinator.startIntent(intent, fillInIntent, STAGE_TYPE_UNDEFINED, position, options, null /* remote */); } private void startIntentLegacy(PendingIntent intent, Intent fillInIntent, @SplitScreen.StageType int stage, @SplitPosition int position, @Nullable Bundle options) { @SplitPosition int position, @Nullable Bundle options) { final WindowContainerTransaction evictWct = new WindowContainerTransaction(); mStageCoordinator.prepareEvictChildTasks(position, evictWct); Loading Loading @@ -347,7 +345,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, }; final WindowContainerTransaction wct = new WindowContainerTransaction(); options = mStageCoordinator.resolveStartStage(stage, position, options, wct); options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options, wct); wct.sendPendingIntent(intent, fillInIntent, options); mSyncQueue.queue(transition, WindowManager.TRANSIT_OPEN, wct); } Loading Loading @@ -604,10 +602,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } @Override public void startTask(int taskId, int stage, int position, @Nullable Bundle options) { public void startTask(int taskId, int position, @Nullable Bundle options) { executeRemoteCallWithTaskPermission(mController, "startTask", (controller) -> { controller.startTask(taskId, stage, position, options); controller.startTask(taskId, position, options); }); } Loading @@ -632,21 +630,20 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } @Override public void startShortcut(String packageName, String shortcutId, int stage, int position, public void startShortcut(String packageName, String shortcutId, int position, @Nullable Bundle options, UserHandle user) { executeRemoteCallWithTaskPermission(mController, "startShortcut", (controller) -> { controller.startShortcut(packageName, shortcutId, stage, position, options, user); controller.startShortcut(packageName, shortcutId, position, options, user); }); } @Override public void startIntent(PendingIntent intent, Intent fillInIntent, int stage, int position, public void startIntent(PendingIntent intent, Intent fillInIntent, int position, @Nullable Bundle options) { executeRemoteCallWithTaskPermission(mController, "startIntent", (controller) -> { controller.startIntent(intent, fillInIntent, stage, position, options); controller.startIntent(intent, fillInIntent, position, options); }); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +7 −4 Original line number Diff line number Diff line Loading @@ -462,12 +462,15 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, @androidx.annotation.Nullable WindowContainerTransaction wct) { switch (stage) { case STAGE_TYPE_UNDEFINED: { // Use the stage of the specified position is valid. if (position != SPLIT_POSITION_UNDEFINED) { if (position == getSideStagePosition()) { options = resolveStartStage(STAGE_TYPE_SIDE, position, options, wct); if (mMainStage.isActive()) { // Use the stage of the specified position options = resolveStartStage( position == mSideStagePosition ? STAGE_TYPE_SIDE : STAGE_TYPE_MAIN, position, options, wct); } else { options = resolveStartStage(STAGE_TYPE_MAIN, position, options, wct); // Use the side stage as default to active split screen options = resolveStartStage(STAGE_TYPE_SIDE, position, options, wct); } } else { // Exit split-screen and launch fullscreen since stage wasn't specified. Loading
libs/WindowManager/Shell/src/com/android/wm/shell/stagesplit/SplitScreenController.java +15 −16 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.view.RemoteAnimationTarget.MODE_OPENING; import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission; 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_UNDEFINED; import android.app.ActivityManager; import android.app.ActivityTaskManager; Loading Loading @@ -208,9 +209,9 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, mStageCoordinator.unregisterSplitScreenListener(listener); } public void startTask(int taskId, @SplitScreen.StageType int stage, @SplitPosition int position, @Nullable Bundle options) { options = mStageCoordinator.resolveStartStage(stage, position, options, null /* wct */); public void startTask(int taskId, @SplitPosition int position, @Nullable Bundle options) { options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options, null /* wct */); try { ActivityTaskManager.getService().startActivityFromRecents(taskId, options); Loading @@ -219,10 +220,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } } public void startShortcut(String packageName, String shortcutId, @SplitScreen.StageType int stage, @SplitPosition int position, public void startShortcut(String packageName, String shortcutId, @SplitPosition int position, @Nullable Bundle options, UserHandle user) { options = mStageCoordinator.resolveStartStage(stage, position, options, null /* wct */); options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options, null /* wct */); try { LauncherApps launcherApps = Loading @@ -234,20 +235,18 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } } public void startIntent(PendingIntent intent, Intent fillInIntent, @SplitScreen.StageType int stage, @SplitPosition int position, public void startIntent(PendingIntent intent, Intent fillInIntent, @SplitPosition int position, @Nullable Bundle options) { if (!Transitions.ENABLE_SHELL_TRANSITIONS) { startIntentLegacy(intent, fillInIntent, stage, position, options); startIntentLegacy(intent, fillInIntent, position, options); return; } mStageCoordinator.startIntent(intent, fillInIntent, stage, position, options, mStageCoordinator.startIntent(intent, fillInIntent, STAGE_TYPE_UNDEFINED, position, options, null /* remote */); } private void startIntentLegacy(PendingIntent intent, Intent fillInIntent, @SplitScreen.StageType int stage, @SplitPosition int position, @Nullable Bundle options) { @SplitPosition int position, @Nullable Bundle options) { LegacyTransitions.ILegacyTransition transition = new LegacyTransitions.ILegacyTransition() { @Override public void onAnimationStart(int transit, RemoteAnimationTarget[] apps, Loading Loading @@ -275,7 +274,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } }; WindowContainerTransaction wct = new WindowContainerTransaction(); options = mStageCoordinator.resolveStartStage(stage, position, options, wct); options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options, wct); wct.sendPendingIntent(intent, fillInIntent, options); mSyncQueue.queue(transition, WindowManager.TRANSIT_OPEN, wct); } Loading Loading @@ -539,7 +538,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, public void startTask(int taskId, int stage, int position, @Nullable Bundle options) { executeRemoteCallWithTaskPermission(mController, "startTask", (controller) -> { controller.startTask(taskId, stage, position, options); controller.startTask(taskId, position, options); }); } Loading Loading @@ -568,7 +567,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, @Nullable Bundle options, UserHandle user) { executeRemoteCallWithTaskPermission(mController, "startShortcut", (controller) -> { controller.startShortcut(packageName, shortcutId, stage, position, controller.startShortcut(packageName, shortcutId, position, options, user); }); } Loading @@ -578,7 +577,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, @Nullable Bundle options) { executeRemoteCallWithTaskPermission(mController, "startIntent", (controller) -> { controller.startIntent(intent, fillInIntent, stage, position, options); controller.startIntent(intent, fillInIntent, position, options); }); } Loading