Skip to content

Commit 50b9b94

Browse files
committed
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 3b10aea commit 50b9b94

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
@@ -9120,6 +9120,14 @@ private final void bringDownServiceLocked(ServiceRecord r, boolean force) {
91209120
if (DEBUG_SERVICE) Slog.v(
91219121
TAG, "Removed service that is not running: " + r);
91229122
}
9123+
9124+
if (r.bindings.size() > 0) {
9125+
r.bindings.clear();
9126+
}
9127+
9128+
if (r.restarter instanceof ServiceRestarter) {
9129+
((ServiceRestarter)r.restarter).setService(null);
9130+
}
91239131
}
91249132

91259133
ComponentName startServiceLocked(IApplicationThread caller,

0 commit comments

Comments
 (0)