diff options
| -rw-r--r-- | services/core/java/com/android/server/audio/AudioService.java | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index e83b03690a24..eaf1555254a7 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -1583,8 +1583,11 @@ public class AudioService extends IAudioService.Stub synchronized (mCachedAbsVolDrivingStreamsLock) { mCachedAbsVolDrivingStreams.forEach((dev, stream) -> { - mAudioSystem.setDeviceAbsoluteVolumeEnabled(dev, /*address=*/"", /*enabled=*/true, - stream); + boolean enabled = true; + if (dev == AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP) { + enabled = mAvrcpAbsVolSupported; + } + mAudioSystem.setDeviceAbsoluteVolumeEnabled(dev, /*address=*/"", enabled, stream); }); } } @@ -4848,7 +4851,7 @@ public class AudioService extends IAudioService.Stub if (absDev == AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP) { enabled = mAvrcpAbsVolSupported; } - if (stream != streamType) { + if (stream != streamType || !enabled) { mAudioSystem.setDeviceAbsoluteVolumeEnabled(absDev, /*address=*/"", enabled, streamType); } @@ -10357,10 +10360,10 @@ public class AudioService extends IAudioService.Stub } /*package*/ void setAvrcpAbsoluteVolumeSupported(boolean support) { - mAvrcpAbsVolSupported = support; - if (absVolumeIndexFix()) { - int a2dpDev = AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP; - synchronized (mCachedAbsVolDrivingStreamsLock) { + synchronized (mCachedAbsVolDrivingStreamsLock) { + mAvrcpAbsVolSupported = support; + if (absVolumeIndexFix()) { + int a2dpDev = AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP; mCachedAbsVolDrivingStreams.compute(a2dpDev, (dev, stream) -> { if (!mAvrcpAbsVolSupported) { mAudioSystem.setDeviceAbsoluteVolumeEnabled(a2dpDev, /*address=*/ @@ -12423,6 +12426,12 @@ public class AudioService extends IAudioService.Stub pw.println("\nLoudness alignment:"); mLoudnessCodecHelper.dump(pw); + pw.println("\nAbsolute voume devices:"); + synchronized (mCachedAbsVolDrivingStreamsLock) { + mCachedAbsVolDrivingStreams.forEach((dev, stream) -> pw.println( + "Device type: 0x" + Integer.toHexString(dev) + ", driving stream " + stream)); + } + mAudioSystem.dump(pw); } |