Skip to content

Commit 3769240

Browse files
Dianne HackbornAndroid Code Review
authored andcommitted
Merge "Clear reference to the IIntentReceiver in order to avoid memory leak"
2 parents 69ebb98 + 5897591 commit 3769240

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11035,6 +11035,9 @@ private final void processNextBroadcast(boolean fromMsg) {
1103511035
performReceiveLocked(r.callerApp, r.resultTo,
1103611036
new Intent(r.intent), r.resultCode,
1103711037
r.resultData, r.resultExtras, false, false);
11038+
// Set this to null so that the reference
11039+
// (local and remote) isnt kept in the mBroadcastHistory.
11040+
r.resultTo = null;
1103811041
} catch (RemoteException e) {
1103911042
Slog.w(TAG, "Failure sending broadcast result of " + r.intent, e);
1104011043
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class BroadcastRecord extends Binder {
4545
final boolean initialSticky; // initial broadcast from register to sticky?
4646
final String requiredPermission; // a permission the caller has required
4747
final List receivers; // contains BroadcastFilter and ResolveInfo
48-
final IIntentReceiver resultTo; // who receives final result if non-null
48+
IIntentReceiver resultTo; // who receives final result if non-null
4949
long dispatchTime; // when dispatch started on this set of receivers
5050
long receiverTime; // when current receiver started for timeouts.
5151
long finishTime; // when we finished the broadcast.

0 commit comments

Comments
 (0)