Ensures that AudioManager.isVolumeFixed() is only used for Android L and above

TBR=perkj
BUG=NONE
TEST=./webrtc/build/android/test_runner.py gtest -s modules_unittests --gtest_filter=AudioDevice* --num_retries=0

Review URL: https://webrtc-codereview.appspot.com/51499004

Cr-Commit-Position: refs/heads/master@{#8909}
This commit is contained in:
henrika 2015-04-01 12:00:00 +02:00
parent f536a507b6
commit 3cd9eaf5e8

View File

@ -228,9 +228,11 @@ class WebRtcAudioTrack {
private boolean SetStreamVolume(int volume) {
Logd("SetStreamVolume(" + volume + ")");
assertTrue(audioManager != null);
if (audioManager.isVolumeFixed()) {
Loge("The device implements a fixed volume policy.");
return false;
if (WebRtcAudioUtils.runningOnLollipopOrHigher()) {
if (audioManager.isVolumeFixed()) {
Loge("The device implements a fixed volume policy.");
return false;
}
}
audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, volume, 0);
return true;