diff options
| author | 2016-03-24 15:26:45 +0000 | |
|---|---|---|
| committer | 2016-03-24 15:26:47 +0000 | |
| commit | 9c91696217ad037e9e808eefbdaaf7d403ecd47d (patch) | |
| tree | 6b460a2a702d54f048a025bbf2ff0f3254c8748b | |
| parent | 4ee3b6216d2d8cef517f13d3e8ee7f274b0cb8b6 (diff) | |
| parent | d34e80c0bc5ddff8289563fef8ca47451b46b459 (diff) | |
Merge "Return to correct home stack task in multi-window mode" into nyc-dev
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityStack.java | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index 26eaa8a2b186..bbc37cd83a18 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -1980,7 +1980,9 @@ final class ActivityStack { if (next == null) { // There are no more activities! final String reason = "noMoreActivities"; - if (!mFullscreen && adjustFocusToNextFocusableStackLocked(reason)) { + final int returnTaskType = prevTask == null || !prevTask.isOverHomeStack() + ? HOME_ACTIVITY_TYPE : prevTask.getTaskToReturnTo(); + if (!mFullscreen && adjustFocusToNextFocusableStackLocked(returnTaskType, reason)) { // Try to move focus to the next visible stack with a running activity if this // stack is not covering the entire screen. return mStackSupervisor.resumeFocusedStackTopActivityLocked( @@ -1993,8 +1995,6 @@ final class ActivityStack { "resumeTopActivityLocked: No more activities go home"); if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked(); // Only resume home if on home display - final int returnTaskType = prevTask == null || !prevTask.isOverHomeStack() ? - HOME_ACTIVITY_TYPE : prevTask.getTaskToReturnTo(); return isOnHomeDisplay() && mStackSupervisor.resumeHomeStackTask(returnTaskType, prev, reason); } @@ -3004,16 +3004,18 @@ final class ActivityStack { } else { final TaskRecord task = r.task; if (r.frontOfTask && task == topTask() && task.isOverHomeStack()) { + final int taskToReturnTo = task.getTaskToReturnTo(); + // For non-fullscreen stack, we want to move the focus to the next visible // stack to prevent the home screen from moving to the top and obscuring // other visible stacks. - if (!mFullscreen && adjustFocusToNextFocusableStackLocked(myReason)) { + if (!mFullscreen + && adjustFocusToNextFocusableStackLocked(taskToReturnTo, myReason)) { return; } // Move the home stack to the top if this stack is fullscreen or there is no // other visible stack. - if (mStackSupervisor.moveHomeStackTaskToTop( - task.getTaskToReturnTo(), myReason)) { + if (mStackSupervisor.moveHomeStackTaskToTop(taskToReturnTo, myReason)) { // Activity focus was already adjusted. Nothing else to do... return; } @@ -3024,12 +3026,16 @@ final class ActivityStack { mService.setFocusedActivityLocked(mStackSupervisor.topRunningActivityLocked(), myReason); } - private boolean adjustFocusToNextFocusableStackLocked(String reason) { + private boolean adjustFocusToNextFocusableStackLocked(int taskToReturnTo, String reason) { final ActivityStack stack = getNextFocusableStackLocked(); final String myReason = reason + " adjustFocusToNextFocusableStack"; if (stack == null) { return false; } + + if (stack.isHomeStack()) { + return mStackSupervisor.moveHomeStackTaskToTop(taskToReturnTo, reason); + } return mService.setFocusedActivityLocked(stack.topRunningActivityLocked(), myReason); } @@ -4843,7 +4849,9 @@ final class ActivityStack { // We only need to adjust focused stack if this stack is in focus. if (isOnHomeDisplay() && mStackSupervisor.isFocusedStack(this)) { String myReason = reason + " leftTaskHistoryEmpty"; - if (mFullscreen || !adjustFocusToNextFocusableStackLocked(myReason)) { + if (mFullscreen + || !adjustFocusToNextFocusableStackLocked( + task.getTaskToReturnTo(), myReason)) { mStackSupervisor.moveHomeStackToFront(myReason); } } |