Suppress the warning toast if the preferredDisplay was set to singleTask

singleTaskInstance displays will only contain one task and any attempt
to launch new task will re-route to the default display.

Bug: 123642392
Test: atest ActivityManagerMultiDisplayTests#testSingleTaskInstanceDisplay
Change-Id: If782a121c5a303b6bfa9f23da59c1a62ef242c7f
This commit is contained in:
Jeff Chang
2019-02-14 20:42:27 +08:00
parent 272c12360f
commit 78f5441879

View File

@@ -2332,6 +2332,20 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
if (!task.canBeLaunchedOnDisplay(actualDisplayId)) {
throw new IllegalStateException("Task resolved to incompatible display");
}
final ActivityDisplay preferredDisplay =
mRootActivityContainer.getActivityDisplay(preferredDisplayId);
final boolean singleTaskInstance = preferredDisplay != null
&& preferredDisplay.isSingleTaskInstance();
if (singleTaskInstance) {
// Suppress the warning toast if the preferredDisplay was set to singleTask.
// The singleTaskInstance displays will only contain one task and any attempt to
// launch new task will re-route to the default display.
return;
}
if (preferredDisplayId != actualDisplayId) {
Slog.w(TAG, "Failed to put " + task + " on display " + preferredDisplayId);
// Display a warning toast that we failed to put a task on a secondary display.