Skip to content
Snippets Groups Projects
Commit 9d121433 authored by Pierre Nicolas's avatar Pierre Nicolas :joy:
Browse files

call: prevent toggle speakerphone to crash

First shot to prevent it to crash.
However conf.call is always null in conference mode so the functionality doesn't work.
GitLab: #1405

Change-Id: I73e3593e4a860925e96d0b20c73ba2aeacae7a5c
parent e913ae2a
Branches
Tags
No related merge requests found
......@@ -324,29 +324,37 @@ class HardwareServiceImpl(
@Synchronized
override fun toggleSpeakerphone(conf: Conference, checked: Boolean) {
Log.w(TAG, "toggleSpeakerphone $conf $checked")
conf.call?.let { call ->
val hasVideo = conf.hasActiveVideo()
disposables.add(conf.call!!.systemConnection
disposables.add(
call.systemConnection
.map {
// Map before subscribe to fallback to the error path if no Telecom API
(it as CallServiceImpl.AndroidCall).connection!!
}
.subscribe({
// Using the Telecom API
it.setWantedAudioState(if (checked) CallConnection.ROUTE_LIST_SPEAKER_EXPLICIT
it.setWantedAudioState(
if (checked) CallConnection.ROUTE_LIST_SPEAKER_EXPLICIT
else if (hasVideo) CallConnection.ROUTE_LIST_SPEAKER_IMPLICIT
else CallConnection.ROUTE_LIST_DEFAULT)
else CallConnection.ROUTE_LIST_DEFAULT
)
}) {
// Fallback to the AudioManager API
JamiService.setAudioPlugin(JamiService.getCurrentAudioOutputPlugin())
mShouldSpeakerphone = checked
if (mHasSpeakerPhone && checked) {
routeToSpeaker()
} else if (mBluetoothWrapper != null && mBluetoothWrapper!!.canBluetooth()) {
} else
if (mBluetoothWrapper != null && mBluetoothWrapper!!.canBluetooth()) {
routeToBTHeadset()
} else {
resetAudio()
}
})
}
)
} ?: Log.e(TAG, "This is a bug. Cannot toggle speaker phone as conference call is null.")
}
@Synchronized
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment