From c63d39d01cfb218d188bfc46bbe6aebd1d145413 Mon Sep 17 00:00:00 2001 From: Garfield Tan Date: Tue, 20 Nov 2018 15:03:11 -0800 Subject: [PATCH] Move back display ID for ActivityOptions. ActivityStackSupervisor#getLaunchStack() is used in ActivityStarter, ActivityStackSupervisor#findTaskToMoveToFront() and ActivityStackSupervisor#anyTaskForIdLocked(). Only ActivityStarter has LaunchParams so we still need to take the display ID from ActivityOptions to avoid further regressions in other cases. Bug: 119794136 Test: Manual test. go/wm-smoke. Change-Id: Ia18bf19cf3648fc416364d78ef4b0b37c576cef4 --- .../java/com/android/server/wm/ActivityStackSupervisor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java index 082f5213cb5d6..f58e9bcc984e8 100644 --- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java @@ -2429,6 +2429,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D // We give preference to the launch preference in activity options. if (options != null) { taskId = options.getLaunchTaskId(); + displayId = options.getLaunchDisplayId(); } // First preference for stack goes to the task Id set in the activity options. Use the stack @@ -2448,7 +2449,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D T stack; // Next preference for stack goes to the display Id set the candidate display. - if (launchParams != null) { + if (launchParams != null && launchParams.mPreferredDisplayId != INVALID_DISPLAY) { displayId = launchParams.mPreferredDisplayId; } if (displayId != INVALID_DISPLAY && canLaunchOnDisplay(r, displayId)) {