diff options
| author | Eric Laurent <elaurent@google.com> | 2015-07-09 18:51:13 +0000 | 
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-09 18:51:14 +0000 | 
| commit | 672d9ca1f0a35f3bda02ddfe81e0e10cebba99c3 (patch) | |
| tree | fef812972971cfbb49e9854d57abb71957cbf374 | |
| parent | db7733ad21ce3369030746d7dcd6684334d6ce20 (diff) | |
| parent | 9a7d922796c61353e30cea5878f41b921adc79b0 (diff) | |
| download | frameworks_av-672d9ca1f0a35f3bda02ddfe81e0e10cebba99c3.zip frameworks_av-672d9ca1f0a35f3bda02ddfe81e0e10cebba99c3.tar.gz frameworks_av-672d9ca1f0a35f3bda02ddfe81e0e10cebba99c3.tar.bz2  | |
Merge "audio policy: add support for device combo with speaker safe" into mnc-dev
| -rwxr-xr-x | services/audiopolicy/common/include/Volume.h | 2 | ||||
| -rwxr-xr-x | services/audiopolicy/enginedefault/src/Engine.cpp | 14 | 
2 files changed, 12 insertions, 4 deletions
diff --git a/services/audiopolicy/common/include/Volume.h b/services/audiopolicy/common/include/Volume.h index 4205589..712f7a7 100755 --- a/services/audiopolicy/common/include/Volume.h +++ b/services/audiopolicy/common/include/Volume.h @@ -82,6 +82,8 @@ public:              //  - HDMI-CEC system audio mode only output: give priority to available item in order.              if (device & AUDIO_DEVICE_OUT_SPEAKER) {                  device = AUDIO_DEVICE_OUT_SPEAKER; +            } else if (device & AUDIO_DEVICE_OUT_SPEAKER_SAFE) { +                device = AUDIO_DEVICE_OUT_SPEAKER_SAFE;              } else if (device & AUDIO_DEVICE_OUT_HDMI_ARC) {                  device = AUDIO_DEVICE_OUT_HDMI_ARC;              } else if (device & AUDIO_DEVICE_OUT_AUX_LINE) { diff --git a/services/audiopolicy/enginedefault/src/Engine.cpp b/services/audiopolicy/enginedefault/src/Engine.cpp index 7a785eb..0686414 100755 --- a/services/audiopolicy/enginedefault/src/Engine.cpp +++ b/services/audiopolicy/enginedefault/src/Engine.cpp @@ -319,8 +319,11 @@ audio_devices_t Engine::getDeviceForStrategy(routing_strategy strategy) const              device = getDeviceForStrategy(STRATEGY_SONIFICATION);              //user "safe" speaker if available instead of normal speaker to avoid triggering              //other acoustic safety mechanisms for notification -            if (device == AUDIO_DEVICE_OUT_SPEAKER && (availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER_SAFE)) -                device = AUDIO_DEVICE_OUT_SPEAKER_SAFE; +            if ((device & AUDIO_DEVICE_OUT_SPEAKER) && +                    (availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER_SAFE)) { +                device |= AUDIO_DEVICE_OUT_SPEAKER_SAFE; +                device &= ~AUDIO_DEVICE_OUT_SPEAKER; +            }          } else if (outputs.isStreamActive(AUDIO_STREAM_MUSIC, SONIFICATION_RESPECTFUL_AFTER_MUSIC_DELAY)) {              // while media is playing (or has recently played), use the same device              device = getDeviceForStrategy(STRATEGY_MEDIA); @@ -329,8 +332,11 @@ audio_devices_t Engine::getDeviceForStrategy(routing_strategy strategy) const              device = getDeviceForStrategy(STRATEGY_SONIFICATION);              //user "safe" speaker if available instead of normal speaker to avoid triggering              //other acoustic safety mechanisms for notification -            if (device == AUDIO_DEVICE_OUT_SPEAKER && (availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER_SAFE)) -                device = AUDIO_DEVICE_OUT_SPEAKER_SAFE; +            if ((device & AUDIO_DEVICE_OUT_SPEAKER) && +                    (availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER_SAFE)) { +                device |= AUDIO_DEVICE_OUT_SPEAKER_SAFE; +                device &= ~AUDIO_DEVICE_OUT_SPEAKER; +            }          }          break;  | 
