From fd6a81c1266466730ee6b6f7c50f5111fd35a15c Mon Sep 17 00:00:00 2001 From: Jeff Chang Date: Mon, 22 Feb 2021 16:16:33 +0800 Subject: [PATCH] Make singleTop activity be created with different display If an instance of the activity already exists at the top of the current task, the system routes the intent to that instance, rather than creating a new instance of the activity. The top task is examined from the global focused stack. This CL checks the existing singleTop instance just from the launching display. Bug: 175098384 Test: atest ActivityStarterTests atest IntentTests atest MultiDisplayActivityLaunchTests Change-Id: Ia0ffe6b8de6bcae738e273b998fd275e70d741cc --- services/core/java/com/android/server/wm/ActivityStarter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java index 37fda4ce217a9..a5089face3217 100644 --- a/services/core/java/com/android/server/wm/ActivityStarter.java +++ b/services/core/java/com/android/server/wm/ActivityStarter.java @@ -1708,7 +1708,7 @@ class ActivityStarter { // If the activity being launched is the same as the one currently at the top, then // we need to check if it should only be launched once. - final Task topRootTask = mRootWindowContainer.getTopDisplayFocusedRootTask(); + final Task topRootTask = mPreferredTaskDisplayArea.getFocusedRootTask(); if (topRootTask != null) { startResult = deliverToCurrentTopIfNeeded(topRootTask, intentGrants); if (startResult != START_SUCCESS) {