Removed route audio to bluetooth setting, already done by TelecomManager

This commit is contained in:
Sylvain Berfini 2024-06-04 14:08:44 +02:00
parent f9f25b2b15
commit ee4e332330
4 changed files with 2 additions and 65 deletions

View file

@ -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

View file

@ -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) {

View file

@ -67,7 +67,6 @@ class SettingsViewModel @UiThread constructor() : GenericViewModel() {
// Calls settings
val echoCancellerEnabled = MutableLiveData<Boolean>()
val routeAudioToBluetooth = MutableLiveData<Boolean>()
val videoEnabled = MutableLiveData<Boolean>()
val videoFecEnabled = MutableLiveData<Boolean>()
@ -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

View file

@ -58,34 +58,6 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:onClick="@{() -> viewModel.toggleRouteAudioToBluetooth()}"
android:id="@+id/route_audio_to_bluetooth_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="10dp"
android:text="@string/settings_calls_route_audio_to_bluetooth_title"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toTopOf="@id/route_audio_to_bluetooth_switch"
app:layout_constraintBottom_toBottomOf="@id/route_audio_to_bluetooth_switch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/route_audio_to_bluetooth_switch"/>
<com.google.android.material.materialswitch.MaterialSwitch
style="@style/material_switch_style"
android:id="@+id/route_audio_to_bluetooth_switch"
android:onClick="@{() -> viewModel.toggleRouteAudioToBluetooth()}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="16dp"
android:checked="@{viewModel.routeAudioToBluetooth}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/echo_canceller_switch" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:onClick="@{() -> viewModel.toggleEnableVideo()}"
@ -112,7 +84,7 @@
android:layout_marginEnd="16dp"
android:checked="@{viewModel.videoEnabled}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/route_audio_to_bluetooth_switch" />
app:layout_constraintTop_toBottomOf="@id/echo_canceller_switch" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"