audio policy: move device_category type outside volume class
This patch prepares the removal of hard coded volume tables by
moving outside volume class the device_category enumeration.
Change-Id: Ic712377898276a39bb782ac0bc7f793cdd7fa8bd
Signed-off-by: François Gaffie <francois.gaffie@intel.com>
diff --git a/services/audiopolicy/engineconfigurable/interface/AudioPolicyPluginInterface.h b/services/audiopolicy/engineconfigurable/interface/AudioPolicyPluginInterface.h
index 74daba5..43d441e 100755
--- a/services/audiopolicy/engineconfigurable/interface/AudioPolicyPluginInterface.h
+++ b/services/audiopolicy/engineconfigurable/interface/AudioPolicyPluginInterface.h
@@ -116,7 +116,7 @@
* @return true if the strategy were set correclty for this stream, false otherwise.
*/
virtual bool setVolumeProfileForStream(const audio_stream_type_t &stream,
- Volume::device_category category,
+ device_category category,
const VolumeCurvePoints &points) = 0;
/**
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.cpp b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.cpp
index 5c155c8..1469c3f 100755
--- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.cpp
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.cpp
@@ -36,10 +36,10 @@
mPolicyPluginInterface(mPolicySubsystem->getPolicyPluginInterface())
{
uint32_t categoryKey = context.getItemAsInteger(MappingKeyCategory);
- if (categoryKey >= Volume::DEVICE_CATEGORY_CNT) {
- mCategory = Volume::DEVICE_CATEGORY_SPEAKER;
+ if (categoryKey >= DEVICE_CATEGORY_CNT) {
+ mCategory = DEVICE_CATEGORY_SPEAKER;
} else {
- mCategory = static_cast<Volume::device_category>(categoryKey);
+ mCategory = static_cast<device_category>(categoryKey);
}
mId = static_cast<audio_stream_type_t>(context.getItemAsInteger(MappingKeyIdentifier));
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.h b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.h
index a00ae84..3c2d9bc 100755
--- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.h
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.h
@@ -58,7 +58,7 @@
audio_stream_type_t mId;
size_t mPoints;
- Volume::device_category mCategory;
+ device_category mCategory;
static const uint32_t gFractional = 8; /**< Beware to align with the structure. */
};
diff --git a/services/audiopolicy/engineconfigurable/src/Engine.cpp b/services/audiopolicy/engineconfigurable/src/Engine.cpp
index 733cdf6..32341ec 100755
--- a/services/audiopolicy/engineconfigurable/src/Engine.cpp
+++ b/services/audiopolicy/engineconfigurable/src/Engine.cpp
@@ -116,7 +116,7 @@
}
bool Engine::setVolumeProfileForStream(const audio_stream_type_t &streamType,
- Volume::device_category deviceCategory,
+ device_category deviceCategory,
const VolumeCurvePoints &points)
{
Stream *stream = getFromCollection<audio_stream_type_t>(streamType);
@@ -199,9 +199,9 @@
return element->template set<Property>(property) == NO_ERROR;
}
-float Engine::volIndexToDb(Volume::device_category category,
- audio_stream_type_t streamType,
- int indexInUi)
+float Engine::volIndexToDb(device_category category,
+ audio_stream_type_t streamType,
+ int indexInUi)
{
Stream *stream = getFromCollection<audio_stream_type_t>(streamType);
if (stream == NULL) {
diff --git a/services/audiopolicy/engineconfigurable/src/Engine.h b/services/audiopolicy/engineconfigurable/src/Engine.h
index 6fa7a13..79bc8ff 100755
--- a/services/audiopolicy/engineconfigurable/src/Engine.h
+++ b/services/audiopolicy/engineconfigurable/src/Engine.h
@@ -97,9 +97,9 @@
virtual void initializeVolumeCurves(bool /*isSpeakerDrcEnabled*/) {}
- virtual float volIndexToDb(Volume::device_category deviceCategory,
- audio_stream_type_t stream,
- int indexInUi)
+ virtual float volIndexToDb(device_category deviceCategory,
+ audio_stream_type_t stream,
+ int indexInUi)
{
return mPolicyEngine->volIndexToDb(deviceCategory, stream, indexInUi);
}
@@ -142,7 +142,7 @@
stream);
}
virtual bool setVolumeProfileForStream(const audio_stream_type_t &stream,
- Volume::device_category deviceCategory,
+ device_category deviceCategory,
const VolumeCurvePoints &points)
{
return mPolicyEngine->setVolumeProfileForStream(stream, deviceCategory, points);
@@ -172,7 +172,7 @@
void setObserver(AudioPolicyManagerObserver *observer);
bool setVolumeProfileForStream(const audio_stream_type_t &stream,
- Volume::device_category deviceCategory,
+ device_category deviceCategory,
const VolumeCurvePoints &points);
status_t initCheck();
@@ -183,9 +183,7 @@
status_t setDeviceConnectionState(audio_devices_t devices, audio_policy_dev_state_t state,
const char *deviceAddress);
- float volIndexToDb(Volume::device_category category,
- audio_stream_type_t stream,
- int indexInUi);
+ float volIndexToDb(device_category category, audio_stream_type_t stream, int indexInUi);
status_t initStreamVolume(audio_stream_type_t stream, int indexMin, int indexMax);
StrategyCollection mStrategyCollection; /**< Strategies indexed by their enum id. */
diff --git a/services/audiopolicy/engineconfigurable/src/Stream.cpp b/services/audiopolicy/engineconfigurable/src/Stream.cpp
index bea2c19..c12ddeb 100755
--- a/services/audiopolicy/engineconfigurable/src/Stream.cpp
+++ b/services/audiopolicy/engineconfigurable/src/Stream.cpp
@@ -62,7 +62,7 @@
return mApplicableStrategy;
}
-status_t Element<audio_stream_type_t>::setVolumeProfile(Volume::device_category category,
+status_t Element<audio_stream_type_t>::setVolumeProfile(device_category category,
const VolumeCurvePoints &points)
{
ALOGD("%s: adding volume profile for %s for device category %d, points nb =%d", __FUNCTION__,
@@ -91,8 +91,7 @@
return NO_ERROR;
}
-float Element<audio_stream_type_t>::volIndexToDb(Volume::device_category deviceCategory,
- int indexInUi)
+float Element<audio_stream_type_t>::volIndexToDb(device_category deviceCategory, int indexInUi)
{
VolumeProfileConstIterator it = mVolumeProfiles.find(deviceCategory);
if (it == mVolumeProfiles.end()) {
diff --git a/services/audiopolicy/engineconfigurable/src/Stream.h b/services/audiopolicy/engineconfigurable/src/Stream.h
index 8c39dc6..b103f89 100755
--- a/services/audiopolicy/engineconfigurable/src/Stream.h
+++ b/services/audiopolicy/engineconfigurable/src/Stream.h
@@ -33,7 +33,7 @@
class Element<audio_stream_type_t>
{
private:
- typedef std::map<Volume::device_category, VolumeCurvePoints> VolumeProfiles;
+ typedef std::map<device_category, VolumeCurvePoints> VolumeProfiles;
typedef VolumeProfiles::iterator VolumeProfileIterator;
typedef VolumeProfiles::const_iterator VolumeProfileConstIterator;
@@ -79,9 +79,9 @@
template <typename Property>
status_t set(Property property);
- status_t setVolumeProfile(Volume::device_category category, const VolumeCurvePoints &points);
+ status_t setVolumeProfile(device_category category, const VolumeCurvePoints &points);
- float volIndexToDb(Volume::device_category deviceCategory, int indexInUi);
+ float volIndexToDb(device_category deviceCategory, int indexInUi);
status_t initVolume(int indexMin, int indexMax);