From ee4e332330fdadfffcb1b72a6bda4b89dd3fe346 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 4 Jun 2024 14:08:44 +0200 Subject: [PATCH] Removed route audio to bluetooth setting, already done by TelecomManager --- .../java/org/linphone/core/CorePreferences.kt | 7 ----- .../viewmodel/MeetingWaitingRoomViewModel.kt | 19 +----------- .../settings/viewmodel/SettingsViewModel.kt | 11 ------- app/src/main/res/layout/settings_calls.xml | 30 +------------------ 4 files changed, 2 insertions(+), 65 deletions(-) diff --git a/app/src/main/java/org/linphone/core/CorePreferences.kt b/app/src/main/java/org/linphone/core/CorePreferences.kt index 363f97c6a..ee16fda73 100644 --- a/app/src/main/java/org/linphone/core/CorePreferences.kt +++ b/app/src/main/java/org/linphone/core/CorePreferences.kt @@ -80,13 +80,6 @@ class CorePreferences @UiThread constructor(private val context: Context) { // Calls settings - @get:WorkerThread @set:WorkerThread - var routeAudioToBluetoothIfAvailable: Boolean - get() = config.getBool("app", "route_audio_to_bluetooth_if_available", true) - set(value) { - config.setBool("app", "route_audio_to_bluetooth_if_available", value) - } - // This won't be done if bluetooth or wired headset is used @get:WorkerThread @set:WorkerThread var routeAudioToSpeakerWhenVideoIsEnabled: Boolean diff --git a/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/MeetingWaitingRoomViewModel.kt b/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/MeetingWaitingRoomViewModel.kt index a05140e77..a7a81ac3f 100644 --- a/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/MeetingWaitingRoomViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/MeetingWaitingRoomViewModel.kt @@ -431,24 +431,7 @@ class MeetingWaitingRoomViewModel @UiThread constructor() : GenericViewModel() { private fun initOutputAudioDevice(videoEnabled: Boolean) { val core = coreContext.core - val audioDevice = if (corePreferences.routeAudioToBluetoothIfAvailable) { - // Prefer bluetooth audio device if setting says so - if (bluetoothAudioDevice != null) { - bluetoothAudioDevice - } else { - if (corePreferences.routeAudioToSpeakerWhenVideoIsEnabled && videoEnabled) { - // If setting says to use speaker when video is enabled, use speaker instead of earpiece - val defaultDevice = core.outputAudioDevice ?: core.defaultOutputAudioDevice - if (defaultDevice?.type == AudioDevice.Type.Earpiece) { - speakerAudioDevice - } else { - defaultDevice - } - } else { - core.outputAudioDevice ?: core.defaultOutputAudioDevice - } - } - } else if (corePreferences.routeAudioToSpeakerWhenVideoIsEnabled && videoEnabled) { + val audioDevice = if (corePreferences.routeAudioToSpeakerWhenVideoIsEnabled && videoEnabled) { // If setting says to use speaker when video is enabled, use speaker instead of earpiece val defaultDevice = core.outputAudioDevice ?: core.defaultOutputAudioDevice if (defaultDevice?.type == AudioDevice.Type.Earpiece) { diff --git a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt index e448ed0c0..311634269 100644 --- a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt @@ -67,7 +67,6 @@ class SettingsViewModel @UiThread constructor() : GenericViewModel() { // Calls settings val echoCancellerEnabled = MutableLiveData() - val routeAudioToBluetooth = MutableLiveData() val videoEnabled = MutableLiveData() val videoFecEnabled = MutableLiveData() @@ -230,7 +229,6 @@ class SettingsViewModel @UiThread constructor() : GenericViewModel() { isUiSecureModeEnabled.postValue(corePreferences.enableSecureMode) echoCancellerEnabled.postValue(core.isEchoCancellationEnabled) - routeAudioToBluetooth.postValue(corePreferences.routeAudioToBluetoothIfAvailable) videoEnabled.postValue(core.isVideoEnabled) videoFecEnabled.postValue(core.isFecEnabled) vibrateDuringIncomingCall.postValue(core.isVibrationOnIncomingCallEnabled) @@ -309,15 +307,6 @@ class SettingsViewModel @UiThread constructor() : GenericViewModel() { } } - @UiThread - fun toggleRouteAudioToBluetooth() { - val newValue = routeAudioToBluetooth.value == false - coreContext.postOnCoreThread { - corePreferences.routeAudioToBluetoothIfAvailable = newValue - routeAudioToBluetooth.postValue(newValue) - } - } - @UiThread fun toggleEnableVideo() { val newValue = videoEnabled.value == false diff --git a/app/src/main/res/layout/settings_calls.xml b/app/src/main/res/layout/settings_calls.xml index 84bfdde95..e8d6d612e 100644 --- a/app/src/main/res/layout/settings_calls.xml +++ b/app/src/main/res/layout/settings_calls.xml @@ -58,34 +58,6 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> - - - - + app:layout_constraintTop_toBottomOf="@id/echo_canceller_switch" />