diff options
| author | 2022-12-07 12:41:38 +0000 | |
|---|---|---|
| committer | 2022-12-07 12:41:38 +0000 | |
| commit | bbdde9c75bd17b2112e063c11378e4695b7f12f6 (patch) | |
| tree | c8713a50d3608000f510baf7a1dabc4569e7de21 | |
| parent | dd4f880e3928a0396607bd375c316eb4ca10255d (diff) | |
| parent | 07e8abc154fab86453759b88f519a56cdf0012f4 (diff) | |
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>
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java | 65 |
1 files changed, 51 insertions, 14 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java index 400039b32618..9329d021d007 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java @@ -529,10 +529,24 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, @SplitPosition int splitPosition, float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) { Intent fillInIntent = null; - if (launchSameComponentAdjacently(pendingIntent, splitPosition, taskId) - && supportMultiInstancesSplit(pendingIntent.getIntent().getComponent())) { - fillInIntent = new Intent(); - fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); + if (launchSameComponentAdjacently(pendingIntent, splitPosition, taskId)) { + if (supportMultiInstancesSplit(pendingIntent.getIntent().getComponent())) { + fillInIntent = new Intent(); + 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, 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, float splitRatio, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { Intent fillInIntent = null; - if (launchSameComponentAdjacently(pendingIntent, splitPosition, taskId) - && supportMultiInstancesSplit(pendingIntent.getIntent().getComponent())) { - fillInIntent = new Intent(); - fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); + if (launchSameComponentAdjacently(pendingIntent, splitPosition, taskId)) { + if (supportMultiInstancesSplit(pendingIntent.getIntent().getComponent())) { + fillInIntent = new Intent(); + 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, options2, splitPosition, splitRatio, remoteTransition, instanceId); @@ -557,12 +578,26 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) { Intent fillInIntent1 = null; Intent fillInIntent2 = null; - if (launchSameComponentAdjacently(pendingIntent1, pendingIntent2) - && supportMultiInstancesSplit(pendingIntent1.getIntent().getComponent())) { - fillInIntent1 = new Intent(); - fillInIntent1.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); - fillInIntent2 = new Intent(); - fillInIntent2.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); + if (launchSameComponentAdjacently(pendingIntent1, pendingIntent2)) { + if (supportMultiInstancesSplit(pendingIntent1.getIntent().getComponent())) { + fillInIntent1 = new Intent(); + fillInIntent1.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); + fillInIntent2 = new Intent(); + 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, pendingIntent2, fillInIntent2, options2, splitPosition, splitRatio, adapter, @@ -601,6 +636,8 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, mStageCoordinator.switchSplitPosition("startIntent"); return; } 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(); return; |