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

Commit bee38836 authored by Jeff Chang's avatar Jeff Chang Committed by Android (Google) Code Review
Browse files

Merge "Suppress the warning toast if the preferredDisplay was set to singleTask"

parents d8b240cb 78f54418
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -2332,6 +2332,20 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
            if (!task.canBeLaunchedOnDisplay(actualDisplayId)) {
            if (!task.canBeLaunchedOnDisplay(actualDisplayId)) {
                throw new IllegalStateException("Task resolved to incompatible display");
                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) {
            if (preferredDisplayId != actualDisplayId) {
                Slog.w(TAG, "Failed to put " + task + " on display " + preferredDisplayId);
                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.
                // Display a warning toast that we failed to put a task on a secondary display.