Merge "Add not supporting multi-instance toast to more entering split flows" into tm-qpr-dev am: 07e8abc154

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20605729

Change-Id: I3df6c891729e763cbddbbfde5cba5809053c294f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jerry Chang
2022-12-07 12:41:38 +00:00
committed by Automerger Merge Worker

View File

@@ -529,10 +529,24 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
@SplitPosition int splitPosition, float splitRatio, RemoteAnimationAdapter adapter, @SplitPosition int splitPosition, float splitRatio, RemoteAnimationAdapter adapter,
InstanceId instanceId) { InstanceId instanceId) {
Intent fillInIntent = null; Intent fillInIntent = null;
if (launchSameComponentAdjacently(pendingIntent, splitPosition, taskId) if (launchSameComponentAdjacently(pendingIntent, splitPosition, taskId)) {
&& supportMultiInstancesSplit(pendingIntent.getIntent().getComponent())) { if (supportMultiInstancesSplit(pendingIntent.getIntent().getComponent())) {
fillInIntent = new Intent(); fillInIntent = new Intent();
fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, "Adding MULTIPLE_TASK");
} else {
try {
adapter.getRunner().onAnimationCancelled(false /* isKeyguardOccluded */);
ActivityTaskManager.getService().startActivityFromRecents(taskId, options2);
} catch (RemoteException e) {
Slog.e(TAG, "Error starting remote animation", e);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN,
"Cancel entering split as not supporting multi-instances");
Toast.makeText(mContext, R.string.dock_multi_instances_not_supported_text,
Toast.LENGTH_SHORT).show();
return;
}
} }
mStageCoordinator.startIntentAndTaskWithLegacyTransition(pendingIntent, fillInIntent, mStageCoordinator.startIntentAndTaskWithLegacyTransition(pendingIntent, fillInIntent,
options1, taskId, options2, splitPosition, splitRatio, adapter, instanceId); options1, taskId, options2, splitPosition, splitRatio, adapter, instanceId);
@@ -542,10 +556,17 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
int taskId, @Nullable Bundle options2, @SplitPosition int splitPosition, int taskId, @Nullable Bundle options2, @SplitPosition int splitPosition,
float splitRatio, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { float splitRatio, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) {
Intent fillInIntent = null; Intent fillInIntent = null;
if (launchSameComponentAdjacently(pendingIntent, splitPosition, taskId) if (launchSameComponentAdjacently(pendingIntent, splitPosition, taskId)) {
&& supportMultiInstancesSplit(pendingIntent.getIntent().getComponent())) { if (supportMultiInstancesSplit(pendingIntent.getIntent().getComponent())) {
fillInIntent = new Intent(); fillInIntent = new Intent();
fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, "Adding MULTIPLE_TASK");
} else {
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN,
"Cancel entering split as not supporting multi-instances");
Toast.makeText(mContext, R.string.dock_multi_instances_not_supported_text,
Toast.LENGTH_SHORT).show();
}
} }
mStageCoordinator.startIntentAndTask(pendingIntent, fillInIntent, options1, taskId, mStageCoordinator.startIntentAndTask(pendingIntent, fillInIntent, options1, taskId,
options2, splitPosition, splitRatio, remoteTransition, instanceId); options2, splitPosition, splitRatio, remoteTransition, instanceId);
@@ -557,12 +578,26 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) { float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) {
Intent fillInIntent1 = null; Intent fillInIntent1 = null;
Intent fillInIntent2 = null; Intent fillInIntent2 = null;
if (launchSameComponentAdjacently(pendingIntent1, pendingIntent2) if (launchSameComponentAdjacently(pendingIntent1, pendingIntent2)) {
&& supportMultiInstancesSplit(pendingIntent1.getIntent().getComponent())) { if (supportMultiInstancesSplit(pendingIntent1.getIntent().getComponent())) {
fillInIntent1 = new Intent(); fillInIntent1 = new Intent();
fillInIntent1.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); fillInIntent1.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
fillInIntent2 = new Intent(); fillInIntent2 = new Intent();
fillInIntent2.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); fillInIntent2.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, "Adding MULTIPLE_TASK");
} else {
try {
adapter.getRunner().onAnimationCancelled(false /* isKeyguardOccluded */);
pendingIntent1.send();
} catch (RemoteException | PendingIntent.CanceledException e) {
Slog.e(TAG, "Error starting remote animation", e);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN,
"Cancel entering split as not supporting multi-instances");
Toast.makeText(mContext, R.string.dock_multi_instances_not_supported_text,
Toast.LENGTH_SHORT).show();
return;
}
} }
mStageCoordinator.startIntentsWithLegacyTransition(pendingIntent1, fillInIntent1, options1, mStageCoordinator.startIntentsWithLegacyTransition(pendingIntent1, fillInIntent1, options1,
pendingIntent2, fillInIntent2, options2, splitPosition, splitRatio, adapter, pendingIntent2, fillInIntent2, options2, splitPosition, splitRatio, adapter,
@@ -601,6 +636,8 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
mStageCoordinator.switchSplitPosition("startIntent"); mStageCoordinator.switchSplitPosition("startIntent");
return; return;
} else { } else {
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN,
"Cancel entering split as not supporting multi-instances");
Toast.makeText(mContext, R.string.dock_multi_instances_not_supported_text, Toast.makeText(mContext, R.string.dock_multi_instances_not_supported_text,
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
return; return;