Merge "AudioService: fix notifications with A2DP abs volume" into klp-dev
This commit is contained in:
@@ -2913,12 +2913,10 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
int index;
|
int index;
|
||||||
if (isMuted()) {
|
if (isMuted()) {
|
||||||
index = 0;
|
index = 0;
|
||||||
} else if (mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_MUSIC &&
|
} else if ((device & AudioSystem.DEVICE_OUT_ALL_A2DP) != 0 &&
|
||||||
(device & AudioSystem.DEVICE_OUT_ALL_A2DP) != 0 &&
|
|
||||||
mAvrcpAbsVolSupported) {
|
mAvrcpAbsVolSupported) {
|
||||||
index = (mIndexMax + 5)/10;
|
index = (mIndexMax + 5)/10;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
index = (getIndex(device) + 5)/10;
|
index = (getIndex(device) + 5)/10;
|
||||||
}
|
}
|
||||||
AudioSystem.setStreamVolumeIndex(mStreamType, index, device);
|
AudioSystem.setStreamVolumeIndex(mStreamType, index, device);
|
||||||
@@ -2943,6 +2941,9 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
if (device != AudioSystem.DEVICE_OUT_DEFAULT) {
|
if (device != AudioSystem.DEVICE_OUT_DEFAULT) {
|
||||||
if (isMuted()) {
|
if (isMuted()) {
|
||||||
index = 0;
|
index = 0;
|
||||||
|
} else if ((device & AudioSystem.DEVICE_OUT_ALL_A2DP) != 0 &&
|
||||||
|
mAvrcpAbsVolSupported) {
|
||||||
|
index = (mIndexMax + 5)/10;
|
||||||
} else {
|
} else {
|
||||||
index = ((Integer)entry.getValue() + 5)/10;
|
index = ((Integer)entry.getValue() + 5)/10;
|
||||||
}
|
}
|
||||||
@@ -3215,7 +3216,14 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
for (int streamType = numStreamTypes - 1; streamType >= 0; streamType--) {
|
for (int streamType = numStreamTypes - 1; streamType >= 0; streamType--) {
|
||||||
if (streamType != streamState.mStreamType &&
|
if (streamType != streamState.mStreamType &&
|
||||||
mStreamVolumeAlias[streamType] == streamState.mStreamType) {
|
mStreamVolumeAlias[streamType] == streamState.mStreamType) {
|
||||||
mStreamStates[streamType].applyDeviceVolume(getDeviceForStream(streamType));
|
// Make sure volume is also maxed out on A2DP device for aliased stream
|
||||||
|
// that may have a different device selected
|
||||||
|
int streamDevice = getDeviceForStream(streamType);
|
||||||
|
if ((device != streamDevice) && mAvrcpAbsVolSupported &&
|
||||||
|
((device & AudioSystem.DEVICE_OUT_ALL_A2DP) != 0)) {
|
||||||
|
mStreamStates[streamType].applyDeviceVolume(device);
|
||||||
|
}
|
||||||
|
mStreamStates[streamType].applyDeviceVolume(streamDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3843,9 +3851,12 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
// address is not used for now, but may be used when multiple a2dp devices are supported
|
// address is not used for now, but may be used when multiple a2dp devices are supported
|
||||||
synchronized (mA2dpAvrcpLock) {
|
synchronized (mA2dpAvrcpLock) {
|
||||||
mAvrcpAbsVolSupported = support;
|
mAvrcpAbsVolSupported = support;
|
||||||
VolumeStreamState streamState = mStreamStates[AudioSystem.STREAM_MUSIC];
|
|
||||||
sendMsg(mAudioHandler, MSG_SET_DEVICE_VOLUME, SENDMSG_QUEUE,
|
sendMsg(mAudioHandler, MSG_SET_DEVICE_VOLUME, SENDMSG_QUEUE,
|
||||||
AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, 0, streamState, 0);
|
AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, 0,
|
||||||
|
mStreamStates[AudioSystem.STREAM_MUSIC], 0);
|
||||||
|
sendMsg(mAudioHandler, MSG_SET_DEVICE_VOLUME, SENDMSG_QUEUE,
|
||||||
|
AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, 0,
|
||||||
|
mStreamStates[AudioSystem.STREAM_RING], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user