From 352d584b20af23a6a99958aafcf8127e6dc09894 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Thu, 19 May 2016 10:20:28 -0700 Subject: [PATCH] Handle trampoline activites in different tasks When the app uses a trampoline activity that launches in a different task than the main task, we fail to show recents when the task is docked and the user launches the trampoline activity from home. Add logic to handle this case. Bug: 28368989 Change-Id: Iea29e6cd1a9919da0e856955691fac4792e30604 --- .../java/com/android/server/am/ActivityStarter.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java index dc4d7b1d8a054..710193776b873 100644 --- a/services/core/java/com/android/server/am/ActivityStarter.java +++ b/services/core/java/com/android/server/am/ActivityStarter.java @@ -558,7 +558,16 @@ class ActivityStarter { startedActivityStackId = mTargetStack.mStackId; } - if (startedActivityStackId == DOCKED_STACK_ID && prevFocusedStackId == HOME_STACK_ID) { + // If we launched the activity from a no display activity that was launched from the home + // screen, we also need to start recents to un-minimize the docked stack, since the + // noDisplay activity will be finished shortly after. + // TODO: We should prevent noDisplay activities from affecting task/stack ordering and + // visibility instead of using this flag. + final boolean noDisplayActivityOverHome = mSourceRecord != null + && mSourceRecord.noDisplay + && mSourceRecord.task.getTaskToReturnTo() == HOME_ACTIVITY_TYPE; + if (startedActivityStackId == DOCKED_STACK_ID + && (prevFocusedStackId == HOME_STACK_ID || noDisplayActivityOverHome)) { final ActivityStack homeStack = mSupervisor.getStack(HOME_STACK_ID); final ActivityRecord topActivityHomeStack = homeStack != null ? homeStack.topRunningActivityLocked() : null;