Fix AudioDeviceInventory#disconnectLeAudio
This CL fixes disconnectLeAudio to disconnect devices properly and make it send becoming noisy intent when an LE audio device is disconnected. (It was removed in ag/17730892 but I don't understand the reason.) It also calls disconnectLeAudio for broadcast profiles. Bug: 230298077 Test: manually turning off BT to check if media is paused. Change-Id: Ifd74c244e19f5e7f92fdbd8f7d20cd99a054425a
This commit is contained in:
@@ -862,8 +862,8 @@ public class AudioDeviceInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*package*/ void disconnectLeAudio(int device) {
|
/*package*/ void disconnectLeAudio(int device) {
|
||||||
if (device != AudioSystem.DEVICE_OUT_BLE_HEADSET ||
|
if (device != AudioSystem.DEVICE_OUT_BLE_HEADSET
|
||||||
device != AudioSystem.DEVICE_OUT_BLE_BROADCAST) {
|
&& device != AudioSystem.DEVICE_OUT_BLE_BROADCAST) {
|
||||||
Log.e(TAG, "disconnectLeAudio: Can't disconnect not LE Audio device " + device);
|
Log.e(TAG, "disconnectLeAudio: Can't disconnect not LE Audio device " + device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -879,6 +879,8 @@ public class AudioDeviceInventory {
|
|||||||
new MediaMetrics.Item(mMetricsId + "disconnectLeAudio")
|
new MediaMetrics.Item(mMetricsId + "disconnectLeAudio")
|
||||||
.record();
|
.record();
|
||||||
if (toRemove.size() > 0) {
|
if (toRemove.size() > 0) {
|
||||||
|
final int delay = checkSendBecomingNoisyIntentInt(device, 0,
|
||||||
|
AudioSystem.DEVICE_NONE);
|
||||||
toRemove.stream().forEach(deviceAddress ->
|
toRemove.stream().forEach(deviceAddress ->
|
||||||
makeLeAudioDeviceUnavailable(deviceAddress, device)
|
makeLeAudioDeviceUnavailable(deviceAddress, device)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -462,6 +462,7 @@ public class BtHelper {
|
|||||||
mDeviceBroker.postBtProfileDisconnected(BluetoothProfile.HEADSET);
|
mDeviceBroker.postBtProfileDisconnected(BluetoothProfile.HEADSET);
|
||||||
mDeviceBroker.postBtProfileDisconnected(BluetoothProfile.HEARING_AID);
|
mDeviceBroker.postBtProfileDisconnected(BluetoothProfile.HEARING_AID);
|
||||||
mDeviceBroker.postBtProfileDisconnected(BluetoothProfile.LE_AUDIO);
|
mDeviceBroker.postBtProfileDisconnected(BluetoothProfile.LE_AUDIO);
|
||||||
|
mDeviceBroker.postBtProfileDisconnected(BluetoothProfile.LE_AUDIO_BROADCAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @GuardedBy("AudioDeviceBroker.mSetModeLock")
|
// @GuardedBy("AudioDeviceBroker.mSetModeLock")
|
||||||
@@ -687,6 +688,7 @@ public class BtHelper {
|
|||||||
case BluetoothProfile.HEADSET:
|
case BluetoothProfile.HEADSET:
|
||||||
case BluetoothProfile.HEARING_AID:
|
case BluetoothProfile.HEARING_AID:
|
||||||
case BluetoothProfile.LE_AUDIO:
|
case BluetoothProfile.LE_AUDIO:
|
||||||
|
case BluetoothProfile.LE_AUDIO_BROADCAST:
|
||||||
mDeviceBroker.postBtProfileDisconnected(profile);
|
mDeviceBroker.postBtProfileDisconnected(profile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user