Loading services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h +25 −6 Original line number Diff line number Diff line Loading @@ -33,6 +33,15 @@ namespace android { // This class gathers together various bits of AudioPolicyManager // configuration, which are usually filled out as a result of parsing // the audio_policy_configuration.xml file. // // Note that AudioPolicyConfig doesn't own some of the data, // it simply proxies access to the fields of AudioPolicyManager // class. Be careful about the fields that are references, // e.g. 'mOutputDevices'. This also means that it's impossible // to implement "deep copying" of this class without re-designing it. class AudioPolicyConfig { public: Loading @@ -40,14 +49,24 @@ public: DeviceVector &outputDevices, DeviceVector &inputDevices, sp<DeviceDescriptor> &defaultOutputDevice) : mEngineLibraryNameSuffix(kDefaultEngineLibraryNameSuffix), mHwModules(hwModules), : mHwModules(hwModules), mOutputDevices(outputDevices), mInputDevices(inputDevices), mDefaultOutputDevice(defaultOutputDevice), mIsSpeakerDrcEnabled(false), mIsCallScreenModeSupported(false) {} mDefaultOutputDevice(defaultOutputDevice) { clear(); } void clear() { mSource = {}; mEngineLibraryNameSuffix = kDefaultEngineLibraryNameSuffix; mHwModules.clear(); mOutputDevices.clear(); mInputDevices.clear(); mDefaultOutputDevice.clear(); mIsSpeakerDrcEnabled = false; mIsCallScreenModeSupported = false; mSurroundFormats.clear(); } const std::string& getSource() const { return mSource; Loading services/audiopolicy/common/managerdefinitions/src/Serializer.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -254,9 +254,8 @@ template <class T> constexpr void (*xmlDeleter)(T* t); template <> constexpr auto xmlDeleter<xmlDoc> = xmlFreeDoc; // http://b/111067277 - Add back constexpr when we switch to C++17. template <> auto xmlDeleter<xmlChar> = [](xmlChar *s) { xmlFree(s); }; constexpr auto xmlDeleter<xmlChar> = [](xmlChar *s) { xmlFree(s); }; /** @return a unique_ptr with the correct deleter for the libxml2 object. */ template <class T> Loading Loading @@ -804,7 +803,9 @@ status_t PolicySerializer::deserialize(const char *configFile, AudioPolicyConfig status_t deserializeAudioPolicyFile(const char *fileName, AudioPolicyConfig *config) { PolicySerializer serializer; return serializer.deserialize(fileName, config); status_t status = serializer.deserialize(fileName, config); if (status != OK) config->clear(); return status; } } // namespace android services/audiopolicy/engine/common/src/EngineBase.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ #include "EngineBase.h" #include "EngineDefaultConfig.h" #include "../include/EngineBase.h" #include <TypeConverter.h> namespace android { Loading services/audiopolicy/engine/config/TEST_MAPPING 0 → 100644 +7 −0 Original line number Diff line number Diff line { "presubmit": [ { "name": "audiopolicy_engineconfig_tests" } ] } services/audiopolicy/engine/config/include/EngineConfig.h +2 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,8 @@ struct ParsingResult { */ ParsingResult parse(const char* path = DEFAULT_PATH); android::status_t parseLegacyVolumes(VolumeGroups &volumeGroups); // Exposed for testing. android::status_t parseLegacyVolumeFile(const char* path, VolumeGroups &volumeGroups); } // namespace engineConfig } // namespace android Loading
services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h +25 −6 Original line number Diff line number Diff line Loading @@ -33,6 +33,15 @@ namespace android { // This class gathers together various bits of AudioPolicyManager // configuration, which are usually filled out as a result of parsing // the audio_policy_configuration.xml file. // // Note that AudioPolicyConfig doesn't own some of the data, // it simply proxies access to the fields of AudioPolicyManager // class. Be careful about the fields that are references, // e.g. 'mOutputDevices'. This also means that it's impossible // to implement "deep copying" of this class without re-designing it. class AudioPolicyConfig { public: Loading @@ -40,14 +49,24 @@ public: DeviceVector &outputDevices, DeviceVector &inputDevices, sp<DeviceDescriptor> &defaultOutputDevice) : mEngineLibraryNameSuffix(kDefaultEngineLibraryNameSuffix), mHwModules(hwModules), : mHwModules(hwModules), mOutputDevices(outputDevices), mInputDevices(inputDevices), mDefaultOutputDevice(defaultOutputDevice), mIsSpeakerDrcEnabled(false), mIsCallScreenModeSupported(false) {} mDefaultOutputDevice(defaultOutputDevice) { clear(); } void clear() { mSource = {}; mEngineLibraryNameSuffix = kDefaultEngineLibraryNameSuffix; mHwModules.clear(); mOutputDevices.clear(); mInputDevices.clear(); mDefaultOutputDevice.clear(); mIsSpeakerDrcEnabled = false; mIsCallScreenModeSupported = false; mSurroundFormats.clear(); } const std::string& getSource() const { return mSource; Loading
services/audiopolicy/common/managerdefinitions/src/Serializer.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -254,9 +254,8 @@ template <class T> constexpr void (*xmlDeleter)(T* t); template <> constexpr auto xmlDeleter<xmlDoc> = xmlFreeDoc; // http://b/111067277 - Add back constexpr when we switch to C++17. template <> auto xmlDeleter<xmlChar> = [](xmlChar *s) { xmlFree(s); }; constexpr auto xmlDeleter<xmlChar> = [](xmlChar *s) { xmlFree(s); }; /** @return a unique_ptr with the correct deleter for the libxml2 object. */ template <class T> Loading Loading @@ -804,7 +803,9 @@ status_t PolicySerializer::deserialize(const char *configFile, AudioPolicyConfig status_t deserializeAudioPolicyFile(const char *fileName, AudioPolicyConfig *config) { PolicySerializer serializer; return serializer.deserialize(fileName, config); status_t status = serializer.deserialize(fileName, config); if (status != OK) config->clear(); return status; } } // namespace android
services/audiopolicy/engine/common/src/EngineBase.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ #include "EngineBase.h" #include "EngineDefaultConfig.h" #include "../include/EngineBase.h" #include <TypeConverter.h> namespace android { Loading
services/audiopolicy/engine/config/TEST_MAPPING 0 → 100644 +7 −0 Original line number Diff line number Diff line { "presubmit": [ { "name": "audiopolicy_engineconfig_tests" } ] }
services/audiopolicy/engine/config/include/EngineConfig.h +2 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,8 @@ struct ParsingResult { */ ParsingResult parse(const char* path = DEFAULT_PATH); android::status_t parseLegacyVolumes(VolumeGroups &volumeGroups); // Exposed for testing. android::status_t parseLegacyVolumeFile(const char* path, VolumeGroups &volumeGroups); } // namespace engineConfig } // namespace android