From a19b5ad748ec8d495ee958e7ac48b9e6cba8e5b4 Mon Sep 17 00:00:00 2001 From: Bryce Lee Date: Wed, 7 Jun 2017 16:54:11 -0700 Subject: [PATCH] Prioritize reused activity's stack over computed stack. It is possible that an activity in one stack may be reused in another. For example, if an activity is started from a launcher intent, but then is started from a home intent (from a ResolverActivity). We currently do not move the activity, leading to a inconsistency as the window manager proceeds to position the task in the focus stack. This changelist addresses the issue by using the reused activity's stack rather than the computed stack. Change-Id: Ie8a099e57e05a20b247bd0c97df8cda69e17c1bb Fixes: 62402289 Test: go/wm-smoke --- .../core/java/com/android/server/am/ActivityStarter.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java index 07caf9e5611a4..1ed2ac19ea9d7 100644 --- a/services/core/java/com/android/server/am/ActivityStarter.java +++ b/services/core/java/com/android/server/am/ActivityStarter.java @@ -2083,6 +2083,10 @@ class ActivityStarter { private ActivityStack getLaunchStack(ActivityRecord r, int launchFlags, TaskRecord task, ActivityOptions aOptions) { + // We are reusing a task, keep the stack! + if (mReuseTask != null) { + return mReuseTask.getStack(); + } // If the activity is of a specific type, return the associated stack, creating it if // necessary @@ -2096,11 +2100,6 @@ class ActivityStarter { return mSupervisor.getStack(ASSISTANT_STACK_ID, CREATE_IF_NEEDED, ON_TOP); } - // We are reusing a task, keep the stack! - if (mReuseTask != null) { - return mReuseTask.getStack(); - } - final int launchDisplayId = (aOptions != null) ? aOptions.getLaunchDisplayId() : INVALID_DISPLAY;