Address memory leaks.

This commit is contained in:
Cody Henthorne
2021-11-11 12:27:22 -05:00
parent 1ad0b0e6ae
commit 3a1f06f510
4 changed files with 44 additions and 39 deletions

View File

@@ -128,15 +128,11 @@ class SignalAudioManager(private val context: Context, private val eventListener
private fun stop(playDisconnect: Boolean) {
Log.d(TAG, "Stopping. state: $state")
if (state == State.UNINITIALIZED) {
Log.i(TAG, "Trying to stop AudioManager in incorrect state: $state")
return
}
incomingRinger.stop()
outgoingRinger.stop()
if (playDisconnect) {
if (playDisconnect && state != State.UNINITIALIZED) {
val volume: Float = androidAudioManager.ringVolumeWithMinimum()
soundPool.play(disconnectedSoundId, volume, volume, 0, 0, 1.0f)
}

View File

@@ -97,10 +97,6 @@ class SignalBluetoothManager(
stopScoAudio()
if (state == State.UNINITIALIZED) {
return
}
context.safeUnregisterReceiver(bluetoothReceiver)
bluetoothReceiver = null