From 89cd19a4c4d274438ec63f79aae091c37e801f18 Mon Sep 17 00:00:00 2001 From: Bryce Lee Date: Wed, 17 May 2017 15:18:35 -0700 Subject: [PATCH] Wait on activity brought to front for trampoline activities. We were previously waiting on a trampoline activity to become visible when an existing activity (when reused via intent match) was brought to front. This will never resolve as the trampoline activity does not become visible. This CL identifies this situation and properly associates the wait with the reused activity. Change-Id: I55f47766e8cdf92e31b4ddd97864cb0f5f3b751a Fixes: 38030545 Test: cts-tradefed run cts -m CtsServicesHostTestCases -t android.server.cts.ActivityManagerAmStartOptionsTests#testDashW_Indirect --- .../core/java/com/android/server/am/ActivityStarter.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java index a2eec5c4bfae0..50d5f962e8677 100644 --- a/services/core/java/com/android/server/am/ActivityStarter.java +++ b/services/core/java/com/android/server/am/ActivityStarter.java @@ -1050,6 +1050,15 @@ class ActivityStarter { reusedActivity = setTargetStackAndMoveToFrontIfNeeded(reusedActivity); + final ActivityRecord outResult = + outActivity != null && outActivity.length > 0 ? outActivity[0] : null; + + // When there is a reused activity and the current result is a trampoline activity, + // set the reused activity as the result. + if (outResult != null && (outResult.finishing || outResult.noDisplay)) { + outActivity[0] = reusedActivity; + } + if ((mStartFlags & START_FLAG_ONLY_IF_NEEDED) != 0) { // We don't need to start a new activity, and the client said not to do anything // if that is the case, so this is it! And for paranoia, make sure we have