skip automatic audio device selection when BT is available

This commit is contained in:
Daniel Gultsch 2024-01-21 13:53:41 +01:00
parent a78747eaa2
commit 21b8bf424a
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2

View file

@ -159,14 +159,15 @@ public class CallIntegration extends Connection {
public void setAudioDeviceWhenAvailable(final AudioDevice audioDevice) {
final var available = getAudioDevices();
if (available.contains(audioDevice)) {
if (available.contains(audioDevice) && !available.contains(AudioDevice.BLUETOOTH)) {
this.setAudioDevice(audioDevice);
} else {
Log.d(
Config.LOGTAG,
"application requested to switch to "
+ audioDevice
+ " but device was not available");
+ " but we won't because available devices are "
+ available);
}
}
@ -407,13 +408,14 @@ public class CallIntegration extends Connection {
final Set<CallIntegration.AudioDevice> availableAudioDevices) {
if (this.initialAudioDevice != null
&& this.initialAudioDeviceConfigured.compareAndSet(false, true)) {
if (availableAudioDevices.contains(this.initialAudioDevice)) {
if (availableAudioDevices.contains(this.initialAudioDevice)
&& !availableAudioDevices.contains(AudioDevice.BLUETOOTH)) {
setAudioDevice(this.initialAudioDevice);
Log.d(Config.LOGTAG, "configured initial audio device");
} else {
Log.d(
Config.LOGTAG,
"initial audio device not available. available devices: "
"not setting initial audio device. available devices: "
+ availableAudioDevices);
}
}