Loading media/libaudiofoundation/AudioContainers.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,13 @@ const DeviceTypeSet& getAudioDeviceOutAllBleSet() { return audioDeviceOutAllBleSet; } const DeviceTypeSet& getAudioDeviceOutLeAudioUnicastSet() { static const DeviceTypeSet audioDeviceOutLeAudioUnicastSet = DeviceTypeSet( std::begin(AUDIO_DEVICE_OUT_BLE_UNICAST_ARRAY), std::end(AUDIO_DEVICE_OUT_BLE_UNICAST_ARRAY)); return audioDeviceOutLeAudioUnicastSet; } std::string deviceTypesToString(const DeviceTypeSet &deviceTypes) { if (deviceTypes.empty()) { return "Empty device types"; Loading media/libaudiofoundation/include/media/AudioContainers.h +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ const DeviceTypeSet& getAudioDeviceOutAllUsbSet(); const DeviceTypeSet& getAudioDeviceInAllSet(); const DeviceTypeSet& getAudioDeviceInAllUsbSet(); const DeviceTypeSet& getAudioDeviceOutAllBleSet(); const DeviceTypeSet& getAudioDeviceOutLeAudioUnicastSet(); template<typename T> static std::vector<T> Intersection(const std::set<T>& a, const std::set<T>& b) { Loading services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h +13 −0 Original line number Diff line number Diff line Loading @@ -517,6 +517,14 @@ public: const sp<SwAudioOutputDescriptor>& desc, uint32_t inPastMs = 0, nsecs_t sysTime = 0) const; /** * @brief isStrategyActive checks if the given strategy is active * on the given output * @param ps product strategy to be checked upon activity status * @return true if an output following the strategy is active, false otherwise */ bool isStrategyActive(product_strategy_t ps) const; /** * @brief clearSessionRoutesForDevice: when a device is disconnected, and if this device has * been chosen as the preferred device by any client, the policy manager shall Loading Loading @@ -562,6 +570,11 @@ public: sp<SwAudioOutputDescriptor> getOutputForClient(audio_port_handle_t portId); /** * return whether any output is active and routed to any of the specified devices */ bool isAnyDeviceTypeActive(const DeviceTypeSet& deviceTypes) const; void dump(String8 *dst) const; }; Loading services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -841,6 +841,16 @@ bool SwAudioOutputCollection::isStrategyActiveOnSameModule(product_strategy_t ps return false; } bool SwAudioOutputCollection::isStrategyActive(product_strategy_t ps) const { for (size_t i = 0; i < size(); i++) { if (valueAt(i)->isStrategyActive(ps)) { return true; } } return false; } audio_io_handle_t SwAudioOutputCollection::getA2dpOutput() const { for (size_t i = 0; i < size(); i++) { Loading Loading @@ -916,6 +926,16 @@ void SwAudioOutputCollection::clearSessionRoutesForDevice( } } } bool SwAudioOutputCollection::isAnyDeviceTypeActive(const DeviceTypeSet& deviceTypes) const { for (size_t i = 0; i < size(); i++) { const sp<SwAudioOutputDescriptor> outputDesc = valueAt(i); if (outputDesc->isActive() && outputDesc->devices().containsDeviceAmongTypes(deviceTypes)) { return true; } } return false; } void SwAudioOutputCollection::dump(String8 *dst) const { Loading services/audiopolicy/engine/common/src/EngineBase.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -72,9 +72,12 @@ status_t EngineBase::setDeviceConnectionState(const sp<DeviceDescriptor> devDesc { audio_devices_t deviceType = devDesc->type(); if ((deviceType != AUDIO_DEVICE_NONE) && audio_is_output_device(deviceType) && deviceType != AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) { && deviceType != AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET && deviceType != AUDIO_DEVICE_OUT_BLE_BROADCAST) { // USB dock does not follow the rule of last removable device connected wins. // It is only used if no removable device is connected or if set as preferred device // LE audio broadcast device has a specific policy depending on active strategies and // devices and does not follow the rule of last connected removable device. mLastRemovableMediaDevices.setRemovableMediaDevices(devDesc, state); } Loading Loading
media/libaudiofoundation/AudioContainers.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,13 @@ const DeviceTypeSet& getAudioDeviceOutAllBleSet() { return audioDeviceOutAllBleSet; } const DeviceTypeSet& getAudioDeviceOutLeAudioUnicastSet() { static const DeviceTypeSet audioDeviceOutLeAudioUnicastSet = DeviceTypeSet( std::begin(AUDIO_DEVICE_OUT_BLE_UNICAST_ARRAY), std::end(AUDIO_DEVICE_OUT_BLE_UNICAST_ARRAY)); return audioDeviceOutLeAudioUnicastSet; } std::string deviceTypesToString(const DeviceTypeSet &deviceTypes) { if (deviceTypes.empty()) { return "Empty device types"; Loading
media/libaudiofoundation/include/media/AudioContainers.h +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ const DeviceTypeSet& getAudioDeviceOutAllUsbSet(); const DeviceTypeSet& getAudioDeviceInAllSet(); const DeviceTypeSet& getAudioDeviceInAllUsbSet(); const DeviceTypeSet& getAudioDeviceOutAllBleSet(); const DeviceTypeSet& getAudioDeviceOutLeAudioUnicastSet(); template<typename T> static std::vector<T> Intersection(const std::set<T>& a, const std::set<T>& b) { Loading
services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h +13 −0 Original line number Diff line number Diff line Loading @@ -517,6 +517,14 @@ public: const sp<SwAudioOutputDescriptor>& desc, uint32_t inPastMs = 0, nsecs_t sysTime = 0) const; /** * @brief isStrategyActive checks if the given strategy is active * on the given output * @param ps product strategy to be checked upon activity status * @return true if an output following the strategy is active, false otherwise */ bool isStrategyActive(product_strategy_t ps) const; /** * @brief clearSessionRoutesForDevice: when a device is disconnected, and if this device has * been chosen as the preferred device by any client, the policy manager shall Loading Loading @@ -562,6 +570,11 @@ public: sp<SwAudioOutputDescriptor> getOutputForClient(audio_port_handle_t portId); /** * return whether any output is active and routed to any of the specified devices */ bool isAnyDeviceTypeActive(const DeviceTypeSet& deviceTypes) const; void dump(String8 *dst) const; }; Loading
services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -841,6 +841,16 @@ bool SwAudioOutputCollection::isStrategyActiveOnSameModule(product_strategy_t ps return false; } bool SwAudioOutputCollection::isStrategyActive(product_strategy_t ps) const { for (size_t i = 0; i < size(); i++) { if (valueAt(i)->isStrategyActive(ps)) { return true; } } return false; } audio_io_handle_t SwAudioOutputCollection::getA2dpOutput() const { for (size_t i = 0; i < size(); i++) { Loading Loading @@ -916,6 +926,16 @@ void SwAudioOutputCollection::clearSessionRoutesForDevice( } } } bool SwAudioOutputCollection::isAnyDeviceTypeActive(const DeviceTypeSet& deviceTypes) const { for (size_t i = 0; i < size(); i++) { const sp<SwAudioOutputDescriptor> outputDesc = valueAt(i); if (outputDesc->isActive() && outputDesc->devices().containsDeviceAmongTypes(deviceTypes)) { return true; } } return false; } void SwAudioOutputCollection::dump(String8 *dst) const { Loading
services/audiopolicy/engine/common/src/EngineBase.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -72,9 +72,12 @@ status_t EngineBase::setDeviceConnectionState(const sp<DeviceDescriptor> devDesc { audio_devices_t deviceType = devDesc->type(); if ((deviceType != AUDIO_DEVICE_NONE) && audio_is_output_device(deviceType) && deviceType != AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) { && deviceType != AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET && deviceType != AUDIO_DEVICE_OUT_BLE_BROADCAST) { // USB dock does not follow the rule of last removable device connected wins. // It is only used if no removable device is connected or if set as preferred device // LE audio broadcast device has a specific policy depending on active strategies and // devices and does not follow the rule of last connected removable device. mLastRemovableMediaDevices.setRemovableMediaDevices(devDesc, state); } Loading