diff options
author | Glenn Kasten <gkasten@google.com> | 2011-02-04 13:54:26 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2011-02-10 14:37:42 -0800 |
commit | 6b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3 (patch) | |
tree | 4f2fb8a9f016de59ddb591ade3e6851a74b6de3a /services | |
parent | fcac8fa9421f442f024018628a6042d7a14fbfb0 (diff) | |
download | frameworks_av-6b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3.zip frameworks_av-6b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3.tar.gz frameworks_av-6b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3.tar.bz2 |
Bug 3352047 Wrong message when adjusting volume
Add hidden AudioManager.getDevicesForStream and output device codes.
Change-Id: I4d1c1d3b6a077cd117720817d1f733dda557b947
Diffstat (limited to 'services')
-rw-r--r-- | services/audioflinger/AudioPolicyManagerBase.cpp | 14 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 8 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.h | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/services/audioflinger/AudioPolicyManagerBase.cpp b/services/audioflinger/AudioPolicyManagerBase.cpp index 04d63e6..58e9b08 100644 --- a/services/audioflinger/AudioPolicyManagerBase.cpp +++ b/services/audioflinger/AudioPolicyManagerBase.cpp @@ -1543,6 +1543,20 @@ uint32_t AudioPolicyManagerBase::getStrategyForStream(AudioSystem::stream_type s return (uint32_t)getStrategy(stream); } +uint32_t AudioPolicyManagerBase::getDevicesForStream(AudioSystem::stream_type stream) { + uint32_t devices; + // By checking the range of stream before calling getStrategy, we avoid + // getStrategy's behavior for invalid streams. getStrategy would do a LOGE + // and then return STRATEGY_MEDIA, but we want to return the empty set. + if (stream < (AudioSystem::stream_type) 0 || stream >= AudioSystem::NUM_STREAM_TYPES) { + devices = 0; + } else { + AudioPolicyManagerBase::routing_strategy strategy = getStrategy(stream); + devices = getDeviceForStrategy(strategy, true); + } + return devices; +} + AudioPolicyManagerBase::routing_strategy AudioPolicyManagerBase::getStrategy( AudioSystem::stream_type stream) { // stream to strategy mapping diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index 953ddac..b614c48 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -365,6 +365,14 @@ uint32_t AudioPolicyService::getStrategyForStream(AudioSystem::stream_type strea return mpPolicyManager->getStrategyForStream(stream); } +uint32_t AudioPolicyService::getDevicesForStream(AudioSystem::stream_type stream) +{ + if (mpPolicyManager == NULL) { + return 0; + } + return mpPolicyManager->getDevicesForStream(stream); +} + audio_io_handle_t AudioPolicyService::getOutputForEffect(effect_descriptor_t *desc) { if (mpPolicyManager == NULL) { diff --git a/services/audioflinger/AudioPolicyService.h b/services/audioflinger/AudioPolicyService.h index 4749b8b..faad893 100644 --- a/services/audioflinger/AudioPolicyService.h +++ b/services/audioflinger/AudioPolicyService.h @@ -86,6 +86,7 @@ public: virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int *index); virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream); + virtual uint32_t getDevicesForStream(AudioSystem::stream_type stream); virtual audio_io_handle_t getOutputForEffect(effect_descriptor_t *desc); virtual status_t registerEffect(effect_descriptor_t *desc, |