Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78f54418 authored by Jeff Chang's avatar Jeff Chang
Browse files

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
parent 272c1236
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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.