Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36028dfc authored by Patty Huang's avatar Patty Huang
Browse files

Add function for getting LE Audio Broadcast device set

Bug: 242472419
Test: atest audiopolicy_tests
Change-Id: Ibdc275f4dd9d2708cf63f02284ba80c6e357d66d
parent 358615af
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -77,6 +77,13 @@ const DeviceTypeSet& getAudioDeviceOutLeAudioUnicastSet() {
    return audioDeviceOutLeAudioUnicastSet;
}

const DeviceTypeSet& getAudioDeviceOutLeAudioBroadcastSet() {
    static const DeviceTypeSet audioDeviceOutLeAudioUnicastSet = DeviceTypeSet(
            std::begin(AUDIO_DEVICE_OUT_BLE_BROADCAST_ARRAY),
            std::end(AUDIO_DEVICE_OUT_BLE_BROADCAST_ARRAY));
    return audioDeviceOutLeAudioUnicastSet;
}

std::string deviceTypesToString(const DeviceTypeSet &deviceTypes) {
    if (deviceTypes.empty()) {
        return "Empty device types";
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ const DeviceTypeSet& getAudioDeviceInAllSet();
const DeviceTypeSet& getAudioDeviceInAllUsbSet();
const DeviceTypeSet& getAudioDeviceOutAllBleSet();
const DeviceTypeSet& getAudioDeviceOutLeAudioUnicastSet();
const DeviceTypeSet& getAudioDeviceOutLeAudioBroadcastSet();

template<typename T>
static std::vector<T> Intersection(const std::set<T>& a, const std::set<T>& b) {
+5 −2
Original line number Diff line number Diff line
@@ -603,7 +603,10 @@ status_t AudioPolicyManager::getHwOffloadFormatsSupportedForBluetoothMedia(
        audioDeviceSet = getAudioDeviceOutAllA2dpSet();
        break;
    case AUDIO_DEVICE_OUT_BLE_HEADSET:
        audioDeviceSet = getAudioDeviceOutAllBleSet();
        audioDeviceSet = getAudioDeviceOutLeAudioUnicastSet();
        break;
    case AUDIO_DEVICE_OUT_BLE_BROADCAST:
        audioDeviceSet = getAudioDeviceOutLeAudioBroadcastSet();
        break;
    default:
        ALOGE("%s() device type 0x%08x not supported", __func__, device);