AudioService: reduce EU volume warning thresdhold for USB headsets

Take into account additional gain due to simultaneous application of
EQ and bass boost by substracting 7dB from current warning message threshold.

Bug: 65225835
Test: check warning displayed when playing over USB headset after boot when
no SIM is present

Change-Id: I1bfcbf571d72122f4df6ff5e40be227c42d555e3
(cherry picked from commit 0e5deb3967)
This commit is contained in:
Eric Laurent
2017-09-01 15:12:42 -07:00
committed by David Lin
parent 60af01bec9
commit 630f37a4ad

View File

@@ -6039,12 +6039,12 @@ public class AudioService extends IAudioService.Stub
private int mSafeMediaVolumeIndex; private int mSafeMediaVolumeIndex;
// mSafeUsbMediaVolumeIndex is used for USB Headsets and is the music volume UI index // mSafeUsbMediaVolumeIndex is used for USB Headsets and is the music volume UI index
// corresponding to a gain of -30 dBFS in audio flinger mixer. // corresponding to a gain of -30 dBFS in audio flinger mixer.
// We remove -15 dBs from the theoretical -15dB to account for the EQ boost when bands are set // We remove -22 dBs from the theoretical -15dB to account for the EQ + bass boost
// to max gain. // amplification when both effects are on with all band gains at maximum.
// This level corresponds to a loudness of 85 dB SPL for the warning to be displayed when // This level corresponds to a loudness of 85 dB SPL for the warning to be displayed when
// the headset is compliant to EN 60950 with a max loudness of 100dB SPL. // the headset is compliant to EN 60950 with a max loudness of 100dB SPL.
private int mSafeUsbMediaVolumeIndex; private int mSafeUsbMediaVolumeIndex;
private static final float SAFE_VOLUME_GAIN_DBFS = -30.0f; private static final float SAFE_VOLUME_GAIN_DBFS = -37.0f;
// mSafeMediaVolumeDevices lists the devices for which safe media volume is enforced, // mSafeMediaVolumeDevices lists the devices for which safe media volume is enforced,
private final int mSafeMediaVolumeDevices = AudioSystem.DEVICE_OUT_WIRED_HEADSET | private final int mSafeMediaVolumeDevices = AudioSystem.DEVICE_OUT_WIRED_HEADSET |
AudioSystem.DEVICE_OUT_WIRED_HEADPHONE | AudioSystem.DEVICE_OUT_WIRED_HEADPHONE |