summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-01-17 17:35:03 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-01-17 17:35:03 -0800
commit63ad6aacc6ce6b729bf25f41376cfea731a2c1eb (patch)
tree7f5a8de6e8540f2424668e5c650dee567194fb4d /media
parentf237a30e9344d43f832ba11db6f62c6ad2084444 (diff)
parent83844cc2f95dc279015b47fd1e18c7cb4eabe9a1 (diff)
downloadframeworks_av-63ad6aacc6ce6b729bf25f41376cfea731a2c1eb.zip
frameworks_av-63ad6aacc6ce6b729bf25f41376cfea731a2c1eb.tar.gz
frameworks_av-63ad6aacc6ce6b729bf25f41376cfea731a2c1eb.tar.bz2
Merge "audio framework: manage stream volume per device"
Diffstat (limited to 'media')
-rw-r--r--media/libmedia/AudioSystem.cpp12
-rw-r--r--media/libmedia/IAudioPolicyService.cpp19
2 files changed, 23 insertions, 8 deletions
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index e537e5a..28892df 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -668,18 +668,22 @@ status_t AudioSystem::initStreamVolume(audio_stream_type_t stream,
return aps->initStreamVolume(stream, indexMin, indexMax);
}
-status_t AudioSystem::setStreamVolumeIndex(audio_stream_type_t stream, int index)
+status_t AudioSystem::setStreamVolumeIndex(audio_stream_type_t stream,
+ int index,
+ audio_devices_t device)
{
const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
if (aps == 0) return PERMISSION_DENIED;
- return aps->setStreamVolumeIndex(stream, index);
+ return aps->setStreamVolumeIndex(stream, index, device);
}
-status_t AudioSystem::getStreamVolumeIndex(audio_stream_type_t stream, int *index)
+status_t AudioSystem::getStreamVolumeIndex(audio_stream_type_t stream,
+ int *index,
+ audio_devices_t device)
{
const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
if (aps == 0) return PERMISSION_DENIED;
- return aps->getStreamVolumeIndex(stream, index);
+ return aps->getStreamVolumeIndex(stream, index, device);
}
uint32_t AudioSystem::getStrategyForStream(audio_stream_type_t stream)
diff --git a/media/libmedia/IAudioPolicyService.cpp b/media/libmedia/IAudioPolicyService.cpp
index 645325b..6205ebd 100644
--- a/media/libmedia/IAudioPolicyService.cpp
+++ b/media/libmedia/IAudioPolicyService.cpp
@@ -240,21 +240,28 @@ public:
return static_cast <status_t> (reply.readInt32());
}
- virtual status_t setStreamVolumeIndex(audio_stream_type_t stream, int index)
+ virtual status_t setStreamVolumeIndex(audio_stream_type_t stream,
+ int index,
+ audio_devices_t device)
{
Parcel data, reply;
data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
data.writeInt32(static_cast <uint32_t>(stream));
data.writeInt32(index);
+ data.writeInt32(static_cast <uint32_t>(device));
remote()->transact(SET_STREAM_VOLUME, data, &reply);
return static_cast <status_t> (reply.readInt32());
}
- virtual status_t getStreamVolumeIndex(audio_stream_type_t stream, int *index)
+ virtual status_t getStreamVolumeIndex(audio_stream_type_t stream,
+ int *index,
+ audio_devices_t device)
{
Parcel data, reply;
data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
data.writeInt32(static_cast <uint32_t>(stream));
+ data.writeInt32(static_cast <uint32_t>(device));
+
remote()->transact(GET_STREAM_VOLUME, data, &reply);
int lIndex = reply.readInt32();
if (index) *index = lIndex;
@@ -525,7 +532,10 @@ status_t BnAudioPolicyService::onTransact(
audio_stream_type_t stream =
static_cast <audio_stream_type_t>(data.readInt32());
int index = data.readInt32();
- reply->writeInt32(static_cast <uint32_t>(setStreamVolumeIndex(stream, index)));
+ audio_devices_t device = static_cast <audio_devices_t>(data.readInt32());
+ reply->writeInt32(static_cast <uint32_t>(setStreamVolumeIndex(stream,
+ index,
+ device)));
return NO_ERROR;
} break;
@@ -533,8 +543,9 @@ status_t BnAudioPolicyService::onTransact(
CHECK_INTERFACE(IAudioPolicyService, data, reply);
audio_stream_type_t stream =
static_cast <audio_stream_type_t>(data.readInt32());
+ audio_devices_t device = static_cast <audio_devices_t>(data.readInt32());
int index;
- status_t status = getStreamVolumeIndex(stream, &index);
+ status_t status = getStreamVolumeIndex(stream, &index, device);
reply->writeInt32(index);
reply->writeInt32(static_cast <uint32_t>(status));
return NO_ERROR;