From 2f9ea1ec49673a81f3eec16a13022c7b1dc7d258 Mon Sep 17 00:00:00 2001 From: Mark Renouf Date: Tue, 5 Mar 2019 14:49:06 -0500 Subject: [PATCH] Only call -rerouted callback if displayId changed This moves the new listener callback method inside the displayId conditional. Without this, the callback is invoked for the initial Bubble activity start by SystemUI. Test: atest ActivityManagerMultiDisplayTests#testSingleTaskInstanceDisplay Bug: 127322070 Change-Id: Ie8d0f4cef82ce77c2b806e9349ec60bc296ef726 --- .../android/server/wm/ActivityStackSupervisor.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java index a8e8c7c5c1427..1ae85b823fd07 100644 --- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java @@ -2430,17 +2430,17 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { final boolean singleTaskInstance = preferredDisplay != null && preferredDisplay.isSingleTaskInstance(); - if (singleTaskInstance) { + if (preferredDisplayId != actualDisplayId) { // 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. - mService.getTaskChangeNotificationController() - .notifyActivityLaunchOnSecondaryDisplayRerouted(task.getTaskInfo(), - preferredDisplayId); - return; - } + if (singleTaskInstance) { + mService.getTaskChangeNotificationController() + .notifyActivityLaunchOnSecondaryDisplayRerouted(task.getTaskInfo(), + preferredDisplayId); + 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. mService.getTaskChangeNotificationController()