Cleanup after ActivityView
- Release Surface and VirtualDisplay when shutting down ActivityView.
- Shut down child stacks when relaunching parent activity.
Change-Id: I60314b2b43bd2da5406cf6ec871293b5baca157c
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 600cc58..c9d6222 100755
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -322,7 +322,7 @@
}
}
- private int numActivities() {
+ int numActivities() {
int count = 0;
for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
count += mTaskHistory.get(taskNdx).mActivities.size();
@@ -2675,6 +2675,7 @@
}
private void removeActivityFromHistoryLocked(ActivityRecord r) {
+ mStackSupervisor.removeChildActivityContainers(r);
finishActivityResultsLocked(r, Activity.RESULT_CANCELED, null);
r.makeFinishing();
if (DEBUG_ADD_REMOVE) {
@@ -3318,6 +3319,8 @@
r.startFreezingScreenLocked(r.app, 0);
+ mStackSupervisor.removeChildActivityContainers(r);
+
try {
if (DEBUG_SWITCH || DEBUG_STATES) Slog.i(TAG,
(andResume ? "Relaunching to RESUMED " : "Relaunching to PAUSED ")
@@ -3350,14 +3353,20 @@
for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
final ActivityRecord r = activities.get(activityNdx);
if (r.appToken == token) {
- return true;
+ return true;
}
if (r.fullscreen && !r.finishing) {
return false;
}
}
}
- return true;
+ final ActivityRecord r = ActivityRecord.forToken(token);
+ if (r == null) {
+ return false;
+ }
+ if (r.finishing) Slog.e(TAG, "willActivityBeVisibleLocked: Returning false,"
+ + " would have returned true for r=" + r);
+ return !r.finishing;
}
void closeSystemDialogsLocked() {