Fix memory leak in Ringtone
BUG: 31938615 Change-Id: Ic736f3494b4da95460bdc0cb7857cc9fcc746ab9
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