Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ffe502bd authored by Andy Hung's avatar Andy Hung
Browse files

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
parent 6aa19711
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -469,6 +469,7 @@ public class Ringtone {
            synchronized (sActiveRingtones) {
                sActiveRingtones.remove(Ringtone.this);
            }
            mp.setOnCompletionListener(null); // Help the Java GC: break the refcount cycle.
        }
    }
}