Ringtone: clear the MediaPlayer listener upon completion

This breaks a local refcount cycle and allows the Java gc to finalize
the Ringtone and MediaPlayer objects quickly.

Bug: 31811091
Change-Id: I0e5a4a78fdc02cc0c8b7811a1f1a45db3c90a0ff
This commit is contained in:
Andy Hung
2016-10-17 18:02:29 -07:00
parent 6aa197116e
commit ffe502bd61

View File

@@ -469,6 +469,7 @@ public class Ringtone {
synchronized (sActiveRingtones) {
sActiveRingtones.remove(Ringtone.this);
}
mp.setOnCompletionListener(null); // Help the Java GC: break the refcount cycle.
}
}
}