audio policy: move volume table to XML file
This patch allows to store in XML file volume tables.
The compatibility is maintained for legacy conf file.
Configurable Engine is only compatible with new XML conf.
This patch removes from configurable engine Structure / Settings the volume
table but keep the configurabllity of switching volume profiles from
one another according to criteria like phone state...
(ex: DTMF stream type is following Voice Profile in call)
Change-Id: I78c91bc3378b6c47202abe7b5c1c1e011ff62eed
Signed-off-by: François Gaffie <francois.gaffie@intel.com>
diff --git a/services/audiopolicy/engineconfigurable/src/Engine.cpp b/services/audiopolicy/engineconfigurable/src/Engine.cpp
index 074af50..7d585c0 100755
--- a/services/audiopolicy/engineconfigurable/src/Engine.cpp
+++ b/services/audiopolicy/engineconfigurable/src/Engine.cpp
@@ -115,18 +115,6 @@
return (mApmObserver != NULL)? NO_ERROR : NO_INIT;
}
-bool Engine::setVolumeProfileForStream(const audio_stream_type_t &streamType,
- device_category deviceCategory,
- const VolumeCurvePoints &points)
-{
- Stream *stream = getFromCollection<audio_stream_type_t>(streamType);
- if (stream == NULL) {
- ALOGE("%s: stream %d not found", __FUNCTION__, streamType);
- return false;
- }
- return stream->setVolumeProfile(deviceCategory, points) == NO_ERROR;
-}
-
template <typename Key>
Element<Key> *Engine::getFromCollection(const Key &key) const
{
@@ -188,6 +176,18 @@
return mPolicyEngine->getPropertyForKey<audio_devices_t, routing_strategy>(strategy);
}
+bool Engine::PluginInterfaceImpl::setVolumeProfileForStream(const audio_stream_type_t &stream,
+ const audio_stream_type_t &profile)
+{
+ if (mPolicyEngine->setPropertyForKey<audio_stream_type_t, audio_stream_type_t>(stream,
+ profile)) {
+ mPolicyEngine->mApmObserver->getVolumeCurves().switchVolumeCurve(profile, stream);
+ return true;
+ }
+ return false;
+}
+
+
template <typename Property, typename Key>
bool Engine::setPropertyForKey(const Property &property, const Key &key)
{
@@ -199,32 +199,6 @@
return element->template set<Property>(property) == NO_ERROR;
}
-float Engine::volIndexToDb(device_category category,
- audio_stream_type_t streamType,
- int indexInUi)
-{
- Stream *stream = getFromCollection<audio_stream_type_t>(streamType);
- if (stream == NULL) {
- ALOGE("%s: Element indexed by key=%d not found", __FUNCTION__, streamType);
- return 1.0f;
- }
- return stream->volIndexToDb(category, indexInUi);
-}
-
-status_t Engine::initStreamVolume(audio_stream_type_t streamType,
- int indexMin, int indexMax)
-{
- Stream *stream = getFromCollection<audio_stream_type_t>(streamType);
- if (stream == NULL) {
- ALOGE("%s: Stream Type %d not found", __FUNCTION__, streamType);
- return BAD_TYPE;
- }
- mApmObserver->getStreamDescriptors().setVolumeIndexMin(streamType, indexMin);
- mApmObserver->getStreamDescriptors().setVolumeIndexMax(streamType, indexMax);
-
- return stream->initVolume(indexMin, indexMax);
-}
-
status_t Engine::setPhoneState(audio_mode_t mode)
{
return mPolicyParameterMgr->setPhoneState(mode);