AbsVol: boost attenuation of the non driving abs vol streams
In order to avoid the double attenuation subtract when playing on
absolute volume devices the attenuation which is already applied by the
absolute volume controller.
Flag: com.android.media.audio.abs_volume_index_fix
Test: logs manual - adb shell setprop log.tag.APM_AudioPolicyManager V
Bug: 340693050
Change-Id: I0c38981565e8d14bf13ac3cd7e26b0edd5e111f6
diff --git a/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index aa51652..3f4fcfd 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -1289,6 +1289,21 @@
(void) status;
}
+status_t AudioSystem::setDeviceAbsoluteVolumeEnabled(audio_devices_t deviceType,
+ const char *address,
+ bool enabled,
+ audio_stream_type_t streamToDriveAbs) {
+ const sp<IAudioPolicyService> aps = get_audio_policy_service();
+ if (aps == nullptr) return PERMISSION_DENIED;
+
+ AudioDevice deviceAidl = VALUE_OR_RETURN_STATUS(
+ legacy2aidl_audio_device_AudioDevice(deviceType, address));
+ AudioStreamType streamToDriveAbsAidl = VALUE_OR_RETURN_STATUS(
+ legacy2aidl_audio_stream_type_t_AudioStreamType(streamToDriveAbs));
+ return statusTFromBinderStatus(
+ aps->setDeviceAbsoluteVolumeEnabled(deviceAidl, enabled, streamToDriveAbsAidl));
+}
+
status_t AudioSystem::initStreamVolume(audio_stream_type_t stream,
int indexMin,
int indexMax) {