Move engine loading out from the AudioPolicyManager
Separating loading of the APM Engine configuration from the APM
initialization. This opens the way for loading the engine
configuration from other sources than the XML file. The APM
receives an engine instance pre-loaded with the configuration on
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
Change-Id: I5185d8e27fccf64ba14856d3a1f0ea07a47f02e0
diff --git a/services/audiopolicy/engine/interface/EngineInterface.h b/services/audiopolicy/engine/interface/EngineInterface.h
index 57174c7..9c156ab 100644
--- a/services/audiopolicy/engine/interface/EngineInterface.h
+++ b/services/audiopolicy/engine/interface/EngineInterface.h
@@ -16,6 +16,7 @@
#pragma once
+#include <string>
#include <utility>
#include <AudioPolicyManagerObserver.h>
@@ -46,6 +47,13 @@
{
public:
/**
+ * Loads the engine configuration from the specified or the default config file.
+ * If loading failed, tries to fall back to some default configuration. If fallback
+ * is impossible, returns an error.
+ */
+ virtual status_t loadFromXmlConfigWithFallback(const std::string& xmlFilePath = "") = 0;
+
+ /**
* Checks if the engine was correctly initialized.
*
* @return NO_ERROR if initialization has been done correctly, error code otherwise..