Merge "AudioService: fix cross deadlock" into qt-dev

This commit is contained in:
Eric Laurent
2019-05-10 15:11:16 +00:00
committed by Android (Google) Code Review

View File

@@ -4974,19 +4974,17 @@ public class AudioService extends IAudioService.Stub
} }
private void onSetVolumeIndexOnDevice(@NonNull DeviceVolumeUpdate update) { private void onSetVolumeIndexOnDevice(@NonNull DeviceVolumeUpdate update) {
synchronized (VolumeStreamState.class) { final VolumeStreamState streamState = mStreamStates[update.mStreamType];
final VolumeStreamState streamState = mStreamStates[update.mStreamType]; if (update.hasVolumeIndex()) {
if (update.hasVolumeIndex()) { final int index = update.getVolumeIndex();
final int index = update.getVolumeIndex(); streamState.setIndex(index, update.mDevice, update.mCaller);
streamState.setIndex(index, update.mDevice, update.mCaller); sVolumeLogger.log(new AudioEventLogger.StringEvent(update.mCaller + " dev:0x"
sVolumeLogger.log(new AudioEventLogger.StringEvent(update.mCaller + " dev:0x" + Integer.toHexString(update.mDevice) + " volIdx:" + index));
+ Integer.toHexString(update.mDevice) + " volIdx:" + index)); } else {
} else { sVolumeLogger.log(new AudioEventLogger.StringEvent(update.mCaller
sVolumeLogger.log(new AudioEventLogger.StringEvent(update.mCaller + " update vol on dev:0x" + Integer.toHexString(update.mDevice)));
+ " update vol on dev:0x" + Integer.toHexString(update.mDevice)));
}
setDeviceVolume(streamState, update.mDevice);
} }
setDeviceVolume(streamState, update.mDevice);
} }
/*package*/ void setDeviceVolume(VolumeStreamState streamState, int device) { /*package*/ void setDeviceVolume(VolumeStreamState streamState, int device) {