Additional cleanup after stack deletion.
- Remove activity from PendingActivityLaunch list when it is removed
from stack. This prevents the delayed launch causing
IllegalArgumentException in b/16045752.
- Move PendingActivityLaunch from ActivityManagerService to
ActivityStackSupervisor.
- Immediately call onTaskListEmptyLocked() in cases where no
activities are found in stack.
Fixes bug 16045752.
Change-Id: Ia69a449e7f5e08ab6e36157d0fd793c4d2fdaca4
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 1038ac0..224946c 100755
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -2558,18 +2558,23 @@
return r;
}
- void finishAllActivitiesLocked() {
+ void finishAllActivitiesLocked(boolean immediately) {
+ boolean noActivitiesInStack = true;
for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
final ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities;
for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
final ActivityRecord r = activities.get(activityNdx);
- if (r.finishing) {
+ noActivitiesInStack = false;
+ if (r.finishing && !immediately) {
continue;
}
- Slog.d(TAG, "finishAllActivitiesLocked: finishing " + r);
+ Slog.d(TAG, "finishAllActivitiesLocked: finishing " + r + " immediately");
finishCurrentActivityLocked(r, FINISH_IMMEDIATELY, false);
}
}
+ if (noActivitiesInStack) {
+ mActivityContainer.onTaskListEmptyLocked();
+ }
}
final boolean navigateUpToLocked(IBinder token, Intent destIntent, int resultCode,
@@ -2683,6 +2688,7 @@
// down to the max limit while they are still waiting to finish.
mStackSupervisor.mFinishingActivities.remove(r);
mStackSupervisor.mWaitingVisibleActivities.remove(r);
+ mStackSupervisor.removePendingActivityLaunchesLocked(r);
// Remove any pending results.
if (r.finishing && r.pendingResults != null) {