Merge "[ActivityManager] Fix ServiceRecord leakage"

This commit is contained in:
Olawale Ogunwale
2015-04-06 15:25:03 +00:00
committed by Gerrit Code Review

View File

@@ -2127,8 +2127,16 @@ public final class ActiveServices {
}
}
// First clear app state from services.
for (int i=app.services.size()-1; i>=0; i--) {
// Clean up any connections this application has to other services.
for (int i = app.connections.size() - 1; i >= 0; i--) {
ConnectionRecord r = app.connections.valueAt(i);
removeConnectionLocked(r, app, null);
}
updateServiceConnectionActivitiesLocked(app);
app.connections.clear();
// Clear app state from services.
for (int i = app.services.size() - 1; i >= 0; i--) {
ServiceRecord sr = app.services.valueAt(i);
synchronized (sr.stats.getBatteryStats()) {
sr.stats.stopLaunchedLocked();
@@ -2188,14 +2196,6 @@ public final class ActiveServices {
}
}
// Clean up any connections this application has to other services.
for (int i=app.connections.size()-1; i>=0; i--) {
ConnectionRecord r = app.connections.valueAt(i);
removeConnectionLocked(r, app, null);
}
updateServiceConnectionActivitiesLocked(app);
app.connections.clear();
ServiceMap smap = getServiceMap(app.userId);
// Now do remaining service cleanup.