AS: Fix sometimes invalid volume set to LE Audio devices

In some cases when LE headet is connected, Audio Service can adjust
other devices volume level. We have to be sure that we use the
right volume level for the right device.

There seems to be a workaround for LE Audio devices, where the
volume level was not set for the outgoing calls. This does not seem
to be a problem anymore, and this workaround actually is the problem
and ocassionally can set volume level stored for the default speaker
device. This sometimes happens when rejecting the incoming call from
the LE Audio earbuds.

With this workaround removed, the issue with rejecting calls was not
reproduced anymore, and the issue with outgoing calls which this
workaround was suppose to prevent, was not observed as well.

It could be that the original issue that this woraround was made for
was already fixed.

Bug: 273165066
Test: tested manually making outgoing calls, taking and rejecting incoming calls
Change-Id: I97250c6cb2a7f3e59e51acbb9382bf03c26864ba
This commit is contained in:
Jakub Tyszkowski
2023-03-22 09:09:10 +00:00
parent e347e926c8
commit 6aa213d77e

View File

@@ -4082,13 +4082,14 @@ public class AudioService extends IAudioService.Stub
return;
}
// Forcefully set LE audio volume as a workaround, since in some cases
// (like the outgoing call) the value of 'device' is not DEVICE_OUT_BLE_*
// even when BLE is connected.
// In some cases (like the outgoing or rejected call) the value of 'device' is not
// DEVICE_OUT_BLE_* even when BLE is connected. Changing the volume level in such case
// may cuase the other devices volume level leaking into the LeAudio device settings.
if (!AudioSystem.isLeAudioDeviceType(device)) {
Log.w(TAG, "setLeAudioVolumeOnModeUpdate got unexpected device=" + device
+ ", forcing to device=" + AudioSystem.DEVICE_OUT_BLE_HEADSET);
device = AudioSystem.DEVICE_OUT_BLE_HEADSET;
Log.w(TAG, "setLeAudioVolumeOnModeUpdate ignoring invalid device="
+ device + ", mode=" + mode + ", index=" + index + " maxIndex=" + maxIndex
+ " streamType=" + streamType);
return;
}
if (DEBUG_VOL) {