Skip to content

Commit a207ce2

Browse files
Ethan1983Dianne Hackborn
authored andcommitted
frameworks/base: Fix to release references in ActivityManagerService
ServiceRecord's bindings is a hashmap to keep track of all active bindings to the service. This is not cleared when the service is brought down by activity manager. This adds up the references to IntentBindRecords and its references to ServiceRecord. Fix is to clear the bindings. ServiceRecord's restarter is a reference to the service and is not cleared when the service is brought down by activity manager. This adds up the references to ServiceRecord. Fix is to set the reference to null when the service is brought down by activity manager. Change-Id: Ica448cd5f60192c8adb23209b5d0e2cf0c04e446
1 parent 3ce8648 commit a207ce2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

services/java/com/android/server/am/ActivityManagerService.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9093,6 +9093,14 @@ private final void bringDownServiceLocked(ServiceRecord r, boolean force) {
90939093
if (DEBUG_SERVICE) Slog.v(
90949094
TAG, "Removed service that is not running: " + r);
90959095
}
9096+
9097+
if (r.bindings.size() > 0) {
9098+
r.bindings.clear();
9099+
}
9100+
9101+
if (r.restarter instanceof ServiceRestarter) {
9102+
((ServiceRestarter)r.restarter).setService(null);
9103+
}
90969104
}
90979105

90989106
ComponentName startServiceLocked(IApplicationThread caller,

0 commit comments

Comments
 (0)