Decouple the configuration from the AudioPolicyManager
Promote AudioPolicyConfig to a full class, not just a "view"
on the APM data. This allows separating initialization of
the APM config from the initialization of the APM itself.
Thus, the APM receives a fully initialized config upon
its creation, regardless of the way the config data has been
obtained.
Bug: 205884982
Test: atest audiopolicy_tests
Test: atest audiosystem_tests
Test: atest audio_health_tests
Test: m audiopolicy_fuzzer
(cherry picked from https://android-review.googlesource.com/q/commit:b0fbc1b40ddebb274b7a0bea811440507c357d82)
Merged-In: I334d16e762499a0292540e6abae4e177480d6235
Change-Id: I334d16e762499a0292540e6abae4e177480d6235
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp
index e5b1c91..7757f37 100644
--- a/services/audiopolicy/service/AudioPolicyService.cpp
+++ b/services/audiopolicy/service/AudioPolicyService.cpp
@@ -46,6 +46,7 @@
#include <system/audio.h>
#include <system/audio_policy.h>
+#include <AudioPolicyConfig.h>
#include <AudioPolicyManager.h>
namespace android {
@@ -185,7 +186,8 @@
static AudioPolicyInterface* createAudioPolicyManager(AudioPolicyClientInterface *clientInterface)
{
- AudioPolicyManager *apm = new AudioPolicyManager(clientInterface);
+ AudioPolicyManager *apm = new AudioPolicyManager(
+ AudioPolicyConfig::loadFromApmXmlConfigWithFallback(), clientInterface);
status_t status = apm->initialize();
if (status != NO_ERROR) {
delete apm;