diff options
| author | 2014-12-17 15:45:03 -0800 | |
|---|---|---|
| committer | 2014-12-17 15:45:03 -0800 | |
| commit | 6b904ef4741321dcb01caee9795c2a044018706c (patch) | |
| tree | 6ead61e379928ccce6c4b6259647d0da8984384d | |
| parent | 052e9b12f5fc7a1e3ecdd126ca8c07298941f291 (diff) | |
Make window mgr stack movement track activity mgr
There were situations where the activity manager ActivityStack was
moved to the front but the corresponding window manager TaskStack
was not. This caused the wrong activity to receive focus which led
to Application Not Responding errors.
One path in particular occurred in startActivityUncheckedLocked()
where curTop.task != intentActivity.task and
sourceStack.topActivity().task != sourceRecord.task. In this case
targetStack.moveTaskToFrontLocked() was never called.
This fix forces all calls to ActivityStack.moveToFront() to make
a call to WindowManagerService.moveTaskToTop() and eliminates
redundant calls to moveTaskToTop().
Fixes bug 17721767.
Change-Id: Ibf01389810dd36724eaec5a4a07560144b2f4cef
| -rwxr-xr-x | services/core/java/com/android/server/am/ActivityStack.java | 9 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityStackSupervisor.java | 4 |
2 files changed, 5 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 efed0b99dc04..9870a1ae65f4 100755 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -480,6 +480,10 @@ final class ActivityStack { } mStacks.remove(this); mStacks.add(this); + final TaskRecord task = topTask(); + if (task != null) { + mWindowManager.moveTaskToTop(task.taskId); + } } } @@ -3478,11 +3482,10 @@ final class ActivityStack { return; } - moveToFront(); - // Shift all activities with this task up to the top // of the stack, keeping them in the same internal order. insertTaskAtTop(tr); + moveToFront(); if (DEBUG_TRANSITION) Slog.v(TAG, "Prepare to front transition: task=" + tr); if (reason != null && @@ -3497,8 +3500,6 @@ final class ActivityStack { updateTransitLocked(AppTransition.TRANSIT_TASK_TO_FRONT, options); } - mWindowManager.moveTaskToTop(tr.taskId); - mStackSupervisor.resumeTopActivitiesLocked(); EventLog.writeEvent(EventLogTags.AM_TASK_TO_FRONT, tr.userId, tr.taskId); diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 262b4f1f3839..df5b3c5500ad 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -2075,8 +2075,6 @@ public final class ActivityStackSupervisor implements DisplayListener { final TaskRecord topTask = targetStack.topTask(); if (topTask != sourceTask) { targetStack.moveTaskToFrontLocked(sourceTask, r, options); - } 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 @@ -2131,8 +2129,6 @@ public final class ActivityStackSupervisor implements DisplayListener { } targetStack = inTask.stack; targetStack.moveTaskToFrontLocked(inTask, r, options); - targetStack.moveToFront(); - mWindowManager.moveTaskToTop(inTask.taskId); // Check whether we should actually launch the new activity in to the task, // or just reuse the current activity on top. |