Merge "Always check front stack on its current display"
This commit is contained in:
committed by
Android (Google) Code Review
commit
85f8603291
@@ -2507,7 +2507,7 @@ final class ActivityStack extends ConfigurationContainer implements StackWindowL
|
||||
if (!next.hasBeenLaunched) {
|
||||
next.hasBeenLaunched = true;
|
||||
} else if (SHOW_APP_STARTING_PREVIEW && lastStack != null &&
|
||||
mStackSupervisor.isFrontStack(lastStack)) {
|
||||
mStackSupervisor.isFrontStackOnDisplay(lastStack)) {
|
||||
next.showStartingWindow(null /* prev */, false /* newTask */,
|
||||
false /* taskSwitch */);
|
||||
}
|
||||
@@ -4354,7 +4354,7 @@ final class ActivityStack extends ConfigurationContainer implements StackWindowL
|
||||
// If we have a watcher, preflight the move before committing to it. First check
|
||||
// for *other* available tasks, but if none are available, then try again allowing the
|
||||
// current task to be selected.
|
||||
if (mStackSupervisor.isFrontStack(this) && mService.mController != null) {
|
||||
if (mStackSupervisor.isFrontStackOnDisplay(this) && mService.mController != null) {
|
||||
ActivityRecord next = topRunningActivityLocked(null, taskId);
|
||||
if (next == null) {
|
||||
next = topRunningActivityLocked(null, 0);
|
||||
|
||||
@@ -624,11 +624,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
|
||||
return stack == mFocusedStack;
|
||||
}
|
||||
|
||||
/** The top most stack. */
|
||||
boolean isFrontStack(ActivityStack stack) {
|
||||
return isFrontOfStackList(stack, mHomeStack.mStacks);
|
||||
}
|
||||
|
||||
/** The top most stack on its display. */
|
||||
boolean isFrontStackOnDisplay(ActivityStack stack) {
|
||||
return isFrontOfStackList(stack, stack.mActivityContainer.mActivityDisplay.mStacks);
|
||||
@@ -1103,13 +1098,21 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
|
||||
}
|
||||
|
||||
// Look in other non-focused and non-home stacks.
|
||||
final ArrayList<ActivityStack> stacks = mHomeStack.mStacks;
|
||||
for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
|
||||
final ActivityStack stack = stacks.get(stackNdx);
|
||||
if (stack != focusedStack && isFrontStack(stack) && stack.isFocusable()) {
|
||||
r = stack.topRunningActivityLocked();
|
||||
if (r != null) {
|
||||
return r;
|
||||
mWindowManager.getDisplaysInFocusOrder(mTmpOrderedDisplayIds);
|
||||
|
||||
for (int i = mTmpOrderedDisplayIds.size() - 1; i >= 0; --i) {
|
||||
final int displayId = mTmpOrderedDisplayIds.get(i);
|
||||
final List<ActivityStack> stacks = mActivityDisplays.get(displayId).mStacks;
|
||||
if (stacks == null) {
|
||||
continue;
|
||||
}
|
||||
for (int j = stacks.size() - 1; j >= 0; --j) {
|
||||
final ActivityStack stack = stacks.get(j);
|
||||
if (stack != focusedStack && isFrontStackOnDisplay(stack) && stack.isFocusable()) {
|
||||
r = stack.topRunningActivityLocked();
|
||||
if (r != null) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2676,7 +2679,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
|
||||
// In some cases the focused stack isn't the front stack. E.g. pinned stack.
|
||||
// Whenever we are moving the top activity from the front stack we want to make sure to move
|
||||
// the stack to the front.
|
||||
final boolean wasFront = isFrontStack(prevStack)
|
||||
final boolean wasFront = isFrontStackOnDisplay(prevStack)
|
||||
&& (prevStack.topRunningActivityLocked() == r);
|
||||
|
||||
if (stackId == DOCKED_STACK_ID && !task.isResizeable()) {
|
||||
|
||||
@@ -6146,6 +6146,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
* Get an array with display ids ordered by focus priority - last items should be given
|
||||
* focus first. Sparse array just maps position to displayId.
|
||||
*/
|
||||
// TODO: Maintain display list in focus order in ActivityManager and remove this call.
|
||||
public void getDisplaysInFocusOrder(SparseIntArray displaysInFocusOrder) {
|
||||
synchronized(mWindowMap) {
|
||||
mRoot.getDisplaysInFocusOrder(displaysInFocusOrder);
|
||||
|
||||
Reference in New Issue
Block a user