audio policy: fix spurious error log at init
Move initialization of communication strategy in AudioPolicyManager::initialize()
before loading HW modules to avoid calling Engine::getDevicesForRoleAndStrategy()
with an unknown strategy.
Test: boot.
Change-Id: I156441aca09807ee4569eb81e3cb7b903a325184
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index f15ed4b..c7d7656 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -4657,6 +4657,9 @@
return status;
}
+ mCommunnicationStrategy = mEngine->getProductStrategyForAttributes(
+ mEngine->getAttributesForStreamType(AUDIO_STREAM_VOICE_CALL));
+
// after parsing the config, mOutputDevicesAll and mInputDevicesAll contain all known devices;
// open all output streams needed to access attached devices
onNewAudioModulesAvailableInt(nullptr /*newDevices*/);
@@ -4686,9 +4689,6 @@
// Silence ALOGV statements
property_set("log.tag." LOG_TAG, "D");
- mCommunnicationStrategy = mEngine->getProductStrategyForAttributes(
- mEngine->getAttributesForStreamType(AUDIO_STREAM_VOICE_CALL));
-
updateDevicesAndOutputs();
return status;
}