diff options
author | Eric Laurent <elaurent@google.com> | 2014-11-03 15:16:04 -0800 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2014-11-03 15:16:04 -0800 |
commit | 03fcdcd0aa9758b6d882b18218fcfb9a1ccffdad (patch) | |
tree | 93729916df7ea6d15a72e4c8b016f7584a480715 /media/libmedia | |
parent | b1322c78b035c9f47ebe57a39799d7a0e13bf57f (diff) | |
download | frameworks_av-03fcdcd0aa9758b6d882b18218fcfb9a1ccffdad.zip frameworks_av-03fcdcd0aa9758b6d882b18218fcfb9a1ccffdad.tar.gz frameworks_av-03fcdcd0aa9758b6d882b18218fcfb9a1ccffdad.tar.bz2 |
audio: fix talkback why alarm is playing
Convert attributes usage "assistance accessibility" to
a stream type guarantying that the prompt is audible
and not muted by policy manager.
Bug: 17994328.
Change-Id: I89f53f2ce84b499b859336c0a1a3a0332ee670f5
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 0a89fbb..c7d5889 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -2127,14 +2127,21 @@ void AudioTrack::setStreamTypeFromAttributes(audio_attributes_t& aa) { // usage to stream type mapping switch (aa.usage) { - case AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY: + case AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY: { // TODO once AudioPolicyManager fully supports audio_attributes_t, - // remove stream change based on phone state - if (AudioSystem::getPhoneState() == AUDIO_MODE_RINGTONE) { + // remove stream change based on stream activity + bool active; + status_t status = AudioSystem::isStreamActive(AUDIO_STREAM_RING, &active, 0); + if (status == NO_ERROR && active == true) { mStreamType = AUDIO_STREAM_RING; break; } - /// FALL THROUGH + status = AudioSystem::isStreamActive(AUDIO_STREAM_ALARM, &active, 0); + if (status == NO_ERROR && active == true) { + mStreamType = AUDIO_STREAM_ALARM; + break; + } + } /// FALL THROUGH case AUDIO_USAGE_MEDIA: case AUDIO_USAGE_GAME: case AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE: |