summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ajay Panicker <apanicke@google.com> 2018-02-27 20:26:21 +0000
committer android-build-merger <android-build-merger@google.com> 2018-02-27 20:26:21 +0000
commiteaf5a4a15a8d52a68b762a721c593b4b0650feb8 (patch)
treea3cfc04e8592882caf72ee9a0931aa36da8af3c8
parent58f4581cb848df23b0368da446aa082bc661974a (diff)
parent5e87e7c98347698e7173687bff03ebdbb5efa863 (diff)
Merge "AudioManager: Use setAvrcpAbsoluteVolume in adjustStreamVolume" am: affa54f01c am: b351b63c2d
am: 5e87e7c983 Change-Id: I23070fd7f15e25ef2006bb43a5c8bd5dadec545f
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 8afa54008baa..ca228201f15d 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -1538,17 +1538,6 @@ public class AudioService extends IAudioService.Stub
if (adjustVolume && (direction != AudioManager.ADJUST_SAME)) {
mAudioHandler.removeMessages(MSG_UNMUTE_STREAM);
- // Check if volume update should be send to AVRCP
- if (streamTypeAlias == AudioSystem.STREAM_MUSIC &&
- (device & AudioSystem.DEVICE_OUT_ALL_A2DP) != 0 &&
- (flags & AudioManager.FLAG_BLUETOOTH_ABS_VOLUME) == 0) {
- synchronized (mA2dpAvrcpLock) {
- if (mA2dp != null && mAvrcpAbsVolSupported) {
- mA2dp.adjustAvrcpAbsoluteVolume(direction);
- }
- }
- }
-
if (isMuteAdjust) {
boolean state;
if (direction == AudioManager.ADJUST_TOGGLE_MUTE) {
@@ -1597,8 +1586,20 @@ public class AudioService extends IAudioService.Stub
0);
}
- // Check if volume update should be sent to Hdmi system audio.
int newIndex = mStreamStates[streamType].getIndex(device);
+
+ // Check if volume update should be send to AVRCP
+ if (streamTypeAlias == AudioSystem.STREAM_MUSIC &&
+ (device & AudioSystem.DEVICE_OUT_ALL_A2DP) != 0 &&
+ (flags & AudioManager.FLAG_BLUETOOTH_ABS_VOLUME) == 0) {
+ synchronized (mA2dpAvrcpLock) {
+ if (mA2dp != null && mAvrcpAbsVolSupported) {
+ mA2dp.setAvrcpAbsoluteVolume(newIndex / 10);
+ }
+ }
+ }
+
+ // Check if volume update should be sent to Hdmi system audio.
if (streamTypeAlias == AudioSystem.STREAM_MUSIC) {
setSystemAudioVolume(oldIndex, newIndex, getStreamMaxVolume(streamType), flags);
}