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

Commit e0db3086 authored by Eric Laurent's avatar Eric Laurent
Browse files

audio policy: fix combo device parsing

When parsing a device type entry in audio_policy.conf, do not
load device combos (e.g AUDIO_DEVICE_OUT_ALL_A2DP) in a single
DeviceDescriptor but create one descriptor for each device type
in the combo.

Bug: 24113912.
Change-Id: I3a7f43c7fc9cf516506bb3255dd2ed86564b7cd6
parent 3583c435
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -294,8 +294,15 @@ void ConfigParsingUtils::loadDevicesFromTag(const char *tag, DeviceVector &devic
        if (strlen(devTag) != 0) {
            audio_devices_t type;
            if (DeviceConverter::fromString(devTag, type)) {
                sp<DeviceDescriptor> dev = new DeviceDescriptor(type);
                uint32_t inBit = type & AUDIO_DEVICE_BIT_IN;
                type &= ~AUDIO_DEVICE_BIT_IN;
                while (type) {
                  audio_devices_t singleType =
                        inBit | (1 << (31 - __builtin_clz(type)));
                    type &= ~singleType;
                    sp<DeviceDescriptor> dev = new DeviceDescriptor(singleType);
                    devices.add(dev);
                }
            } else {
                sp<DeviceDescriptor> deviceDesc =
                        declaredDevices.getDeviceFromTagName(String8(devTag));