CSD: Fix condition when dropping HAL BT CSD vals
When the device type is bluetooth and we do not have a cached
categorization we assume category unknown which should not allow the HAL
CSD values to propagate.
Test: manual test w/o automatic_bt_device_type
Bug: 325406957
Change-Id: I265a53b687405244cf01947e128dd59471b82ec2
diff --git a/services/audioflinger/sounddose/SoundDoseManager.cpp b/services/audioflinger/sounddose/SoundDoseManager.cpp
index 8d40b63..3b764d1 100644
--- a/services/audioflinger/sounddose/SoundDoseManager.cpp
+++ b/services/audioflinger/sounddose/SoundDoseManager.cpp
@@ -231,10 +231,12 @@
ALOGI("%s: could not find port id for device %s", __func__, adt.toString().c_str());
return AUDIO_PORT_HANDLE_NONE;
}
- const auto btDeviceIt = mBluetoothDevicesWithCsd.find(std::make_pair(address, type));
- if (btDeviceIt != mBluetoothDevicesWithCsd.end()) {
- if (!btDeviceIt->second) {
- ALOGI("%s: bt device %s does not support sound dose", __func__, adt.toString().c_str());
+
+ if (audio_is_ble_out_device(type) || audio_is_a2dp_device(type)) {
+ const auto btDeviceIt = mBluetoothDevicesWithCsd.find(std::make_pair(address, type));
+ if (btDeviceIt == mBluetoothDevicesWithCsd.end() || !btDeviceIt->second) {
+ ALOGI("%s: bt device %s does not support sound dose", __func__,
+ adt.toString().c_str());
return AUDIO_PORT_HANDLE_NONE;
}
}