From c750f5fd2b638b33d147545eac5088e5214975a7 Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Mon, 28 Mar 2016 07:43:51 -0700 Subject: [PATCH] Don't show home activity when exiting split-screen with recents visible If we will be focusing on the home stack next and its current top activity is visible, then use it as the next task to display vs the return to value. Bug: 27859516 Bug: 27776008 Change-Id: I5aec0bafb07b7c7391608efdfbdc46b1496d6b57 --- .../core/java/com/android/server/am/ActivityStack.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index e4ffde2ad0094..4c0664542cc6f 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -3090,10 +3090,14 @@ final class ActivityStack { return false; } - if (stack.isHomeStack()) { + final ActivityRecord top = stack.topRunningActivityLocked(); + + if (stack.isHomeStack() && (top == null || !top.visible)) { + // If we will be focusing on the home stack next and its current top activity isn't + // visible, then use the task return to value to determine the home task to display next. return mStackSupervisor.moveHomeStackTaskToTop(taskToReturnTo, reason); } - return mService.setFocusedActivityLocked(stack.topRunningActivityLocked(), myReason); + return mService.setFocusedActivityLocked(top, myReason); } final void stopActivityLocked(ActivityRecord r) {