diff options
author | Craig Mautner <cmautner@google.com> | 2014-10-15 12:52:10 -0700 |
---|---|---|
committer | Craig Mautner <cmautner@google.com> | 2014-10-15 14:11:23 -0700 |
commit | 737fae2b2ea77e390c0dc1c91e9e1a98dac07d22 (patch) | |
tree | 8eb9525dc83e165c6de353c5cd4d74de792f96b0 /services | |
parent | 29c58cad4ef8a14ec0a723318a92da85c8325c88 (diff) | |
download | frameworks_base-737fae2b2ea77e390c0dc1c91e9e1a98dac07d22.zip frameworks_base-737fae2b2ea77e390c0dc1c91e9e1a98dac07d22.tar.gz frameworks_base-737fae2b2ea77e390c0dc1c91e9e1a98dac07d22.tar.bz2 |
Move desired task to top if not already there.
Under certain circumstances when launching a new activity, the
topmost stack activity is moved to the front even though the
activity is being created in a different task.
This checks if the topmost stack task matches the desired
task and if not, moves the desired task to the top.
Also make activity dump ordering consistent.
Fixes bug 17721767.
Change-Id: I59397f31b629a208f3863887c57d6f6fb1f6e1f3
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/am/ActivityStackSupervisor.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index bbfb62a..879ddc0 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -2058,7 +2058,13 @@ public final class ActivityStackSupervisor implements DisplayListener { } targetStack = sourceTask.stack; targetStack.moveToFront(); - mWindowManager.moveTaskToTop(targetStack.topTask().taskId); + final TaskRecord topTask = targetStack.topTask(); + if (topTask != sourceTask) { + targetStack.moveTaskToFrontLocked(sourceTask, r, options); + Slog.w(TAG, "top task and source task don't match. would have caused anr"); + } else { + mWindowManager.moveTaskToTop(topTask.taskId); + } if (!addingToTask && (launchFlags&Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) { // In this case, we are adding the activity to an existing // task, but the caller has asked to clear that task if the @@ -3097,10 +3103,9 @@ public final class ActivityStackSupervisor implements DisplayListener { for (int displayNdx = 0; displayNdx < mActivityDisplays.size(); ++displayNdx) { ActivityDisplay activityDisplay = mActivityDisplays.valueAt(displayNdx); pw.print("Display #"); pw.print(activityDisplay.mDisplayId); - pw.println(" (activities from bottom to top):"); + pw.println(" (activities from top to bottom):"); ArrayList<ActivityStack> stacks = activityDisplay.mStacks; - final int numStacks = stacks.size(); - for (int stackNdx = 0; stackNdx < numStacks; ++stackNdx) { + for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) { final ActivityStack stack = stacks.get(stackNdx); StringBuilder stackHeader = new StringBuilder(128); stackHeader.append(" Stack #"); |