Fix memory leak in Ringtone
am: 76ed4ddca0
Change-Id: I7c1167593ba2cc960dbb0b57385c574f5c22f2ad
This commit is contained in:
@@ -368,6 +368,7 @@ public class Ringtone {
|
||||
|
||||
private void destroyLocalPlayer() {
|
||||
if (mLocalPlayer != null) {
|
||||
mLocalPlayer.setOnCompletionListener(null);
|
||||
mLocalPlayer.reset();
|
||||
mLocalPlayer.release();
|
||||
mLocalPlayer = null;
|
||||
@@ -464,11 +465,14 @@ public class Ringtone {
|
||||
}
|
||||
|
||||
class MyOnCompletionListener implements MediaPlayer.OnCompletionListener {
|
||||
public void onCompletion(MediaPlayer mp)
|
||||
{
|
||||
@Override
|
||||
public void onCompletion(MediaPlayer mp) {
|
||||
synchronized (sActiveRingtones) {
|
||||
sActiveRingtones.remove(Ringtone.this);
|
||||
}
|
||||
if (mLocalPlayer != null) {
|
||||
mLocalPlayer.setOnCompletionListener(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user