Support starts a pair of intent/shortcut and task to split

Add startIntentAndTask and startShortcutAndTask APIs to support starts a
pair of intent/shortcut and task to split with shell-transition.

Fix: 250875492
Test: atest WMShellFlickerTests
Test: manual check start tasks or start intent/shortcut with task flow
      with shell-transition enabled
Change-Id: Ibce60f3a10e2bbc99ef17185f45680dc23ef5f48
This commit is contained in:
Jerry Chang
2022-10-04 14:41:26 +00:00
parent e3f95693ef
commit 3d39bfcda7
3 changed files with 58 additions and 15 deletions

View File

@@ -562,6 +562,34 @@ public class SystemUiProxy implements ISystemUiProxy {
}
}
public void startIntentAndTask(PendingIntent pendingIntent, Intent fillInIntent,
Bundle options1, int taskId, Bundle options2,
@SplitConfigurationOptions.StagePosition int splitPosition, float splitRatio,
RemoteTransitionCompat remoteTransition, InstanceId instanceId) {
if (mSystemUiProxy != null) {
try {
mSplitScreen.startIntentAndTask(pendingIntent, fillInIntent, options1,
taskId, options2, splitPosition, splitRatio,
remoteTransition.getTransition(), instanceId);
} catch (RemoteException e) {
Log.w(TAG, "Failed call startIntentAndTask");
}
}
}
public void startShortcutAndTask(ShortcutInfo shortcutInfo, Bundle options1, int taskId,
Bundle options2, @SplitConfigurationOptions.StagePosition int splitPosition,
float splitRatio, RemoteTransitionCompat remoteTransition, InstanceId instanceId) {
if (mSystemUiProxy != null) {
try {
mSplitScreen.startShortcutAndTask(shortcutInfo, options1, taskId, options2,
splitPosition, splitRatio, remoteTransition.getTransition(), instanceId);
} catch (RemoteException e) {
Log.w(TAG, "Failed call startShortcutAndTask");
}
}
}
/**
* Start multiple tasks in split-screen simultaneously.
*/

View File

@@ -15,7 +15,6 @@
*/
package com.android.quickstep;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
@@ -426,8 +425,10 @@ public final class TaskViewUtils {
TransitionInfo.Change splitRoot2 = null;
for (int i = 0; i < transitionInfo.getChanges().size(); ++i) {
final TransitionInfo.Change change = transitionInfo.getChanges().get(i);
final int taskId = change.getTaskInfo() != null ? change.getTaskInfo().taskId : -1;
if (change.getTaskInfo() == null) continue;
final int taskId = change.getTaskInfo().taskId;
final int mode = change.getMode();
// Find the target tasks' root tasks since those are the split stages that need to
// be animated (the tasks themselves are children and thus inherit animation).
if (taskId == initialTaskId || taskId == secondTaskId) {
@@ -440,7 +441,7 @@ public final class TaskViewUtils {
+ "root of " + taskId + " is already visible or has broken hierarchy.");
}
}
if (taskId == initialTaskId && initialTaskId != INVALID_TASK_ID) {
if (taskId == initialTaskId) {
splitRoot1 = transitionInfo.getChange(change.getParent());
}
if (taskId == secondTaskId) {

View File

@@ -214,18 +214,36 @@ public class SplitSelectStateController {
@Nullable InstanceId shellInstanceId) {
TestLogging.recordEvent(
TestProtocol.SEQUENCE_MAIN, "launchSplitTasks");
final ActivityOptions options1 = ActivityOptions.makeBasic();
if (freezeTaskList) {
options1.setFreezeRecentTasksReordering();
}
if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
RemoteSplitLaunchTransitionRunner animationRunner =
final RemoteSplitLaunchTransitionRunner animationRunner =
new RemoteSplitLaunchTransitionRunner(taskId1, taskPendingIntent, taskId2,
callback);
mSystemUiProxy.startTasks(taskId1, null /* options1 */, taskId2,
null /* options2 */, stagePosition, splitRatio,
new RemoteTransitionCompat(animationRunner, MAIN_EXECUTOR,
ActivityThread.currentActivityThread().getApplicationThread()),
shellInstanceId);
// TODO(b/237635859): handle intent/shortcut + task with shell transition
final RemoteTransitionCompat remoteTransition = new RemoteTransitionCompat(
animationRunner, MAIN_EXECUTOR,
ActivityThread.currentActivityThread().getApplicationThread());
if (taskPendingIntent == null) {
mSystemUiProxy.startTasks(taskId1, options1.toBundle(), taskId2,
null /* options2 */, stagePosition, splitRatio, remoteTransition,
shellInstanceId);
} else {
final ShortcutInfo shortcutInfo = getShortcutInfo(mInitialTaskIntent,
taskPendingIntent.getCreatorUserHandle());
if (shortcutInfo != null) {
mSystemUiProxy.startShortcutAndTask(shortcutInfo,
options1.toBundle(), taskId2, null /* options2 */, stagePosition,
splitRatio, remoteTransition, shellInstanceId);
} else {
mSystemUiProxy.startIntentAndTask(taskPendingIntent,
fillInIntent, options1.toBundle(), taskId2, null /* options2 */,
stagePosition, splitRatio, remoteTransition, shellInstanceId);
}
}
} else {
RemoteSplitLaunchAnimationRunner animationRunner =
final RemoteSplitLaunchAnimationRunner animationRunner =
new RemoteSplitLaunchAnimationRunner(taskId1, taskPendingIntent, taskId2,
callback);
final RemoteAnimationAdapter adapter = new RemoteAnimationAdapter(
@@ -233,10 +251,6 @@ public class SplitSelectStateController {
300, 150,
ActivityThread.currentActivityThread().getApplicationThread());
ActivityOptions options1 = ActivityOptions.makeBasic();
if (freezeTaskList) {
options1.setFreezeRecentTasksReordering();
}
if (taskPendingIntent == null) {
mSystemUiProxy.startTasksWithLegacyTransition(taskId1, options1.toBundle(),
taskId2, null /* options2 */, stagePosition, splitRatio, adapter,