Fix disconnect sound on call termination.

fork-5.53.8
Cody Henthorne 2022-03-16 10:08:06 -04:00
rodzic c7016aa462
commit 5b5b118b7a
1 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

@ -413,6 +413,8 @@ class TelecomAwareSignalAudioManager(context: Context, eventListener: EventListe
if (!focusedGained) {
handler.postDelayed({ androidAudioManager.requestCallAudioFocus() }, 500)
}
state = State.PREINITIALIZED
}
override fun start() {
@ -423,11 +425,21 @@ class TelecomAwareSignalAudioManager(context: Context, eventListener: EventListe
if (!focusedGained) {
handler.postDelayed({ androidAudioManager.requestCallAudioFocus() }, 500)
}
state = State.RUNNING
}
override fun stop(playDisconnect: Boolean) {
incomingRinger.stop()
outgoingRinger.stop()
if (playDisconnect && state != State.UNINITIALIZED) {
val volume: Float = androidAudioManager.ringVolumeWithMinimum()
soundPool.play(disconnectedSoundId, volume, volume, 0, 0, 1.0f)
}
state = State.UNINITIALIZED
androidAudioManager.abandonCallAudioFocus()
}