Merge "Fix AudioDeviceInventory#disconnectLeAudio" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-04-28 07:38:34 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 2 deletions

View File

@@ -862,8 +862,8 @@ public class AudioDeviceInventory {
}
/*package*/ void disconnectLeAudio(int device) {
if (device != AudioSystem.DEVICE_OUT_BLE_HEADSET ||
device != AudioSystem.DEVICE_OUT_BLE_BROADCAST) {
if (device != AudioSystem.DEVICE_OUT_BLE_HEADSET
&& device != AudioSystem.DEVICE_OUT_BLE_BROADCAST) {
Log.e(TAG, "disconnectLeAudio: Can't disconnect not LE Audio device " + device);
return;
}
@@ -879,6 +879,8 @@ public class AudioDeviceInventory {
new MediaMetrics.Item(mMetricsId + "disconnectLeAudio")
.record();
if (toRemove.size() > 0) {
final int delay = checkSendBecomingNoisyIntentInt(device, 0,
AudioSystem.DEVICE_NONE);
toRemove.stream().forEach(deviceAddress ->
makeLeAudioDeviceUnavailable(deviceAddress, device)
);

View File

@@ -462,6 +462,7 @@ public class BtHelper {
mDeviceBroker.postBtProfileDisconnected(BluetoothProfile.HEADSET);
mDeviceBroker.postBtProfileDisconnected(BluetoothProfile.HEARING_AID);
mDeviceBroker.postBtProfileDisconnected(BluetoothProfile.LE_AUDIO);
mDeviceBroker.postBtProfileDisconnected(BluetoothProfile.LE_AUDIO_BROADCAST);
}
// @GuardedBy("AudioDeviceBroker.mSetModeLock")
@@ -687,6 +688,7 @@ public class BtHelper {
case BluetoothProfile.HEADSET:
case BluetoothProfile.HEARING_AID:
case BluetoothProfile.LE_AUDIO:
case BluetoothProfile.LE_AUDIO_BROADCAST:
mDeviceBroker.postBtProfileDisconnected(profile);
break;