Hi Xiyuan,
I have got the following solution from my colleague and tested it!
-----------------------------------------------------------------------------------------------------
Two modifications were needed to adjust hdmi volume:
- “myandroid/hardware/libhardware_legacy/audio/AudioPolicyManagerBase.cpp”, function computeVolume()
From
// if volume is not 0 (not muted), force media volume to max on digital output
if (stream == AudioSystem::MUSIC &&
index != mStreams[stream].mIndexMin &&
(((device == AUDIO_DEVICE_OUT_AUX_DIGITAL) && (mDeviceIsHdmidongle == false)) ||
device == AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET ||
device == AUDIO_DEVICE_OUT_USB_ACCESSORY ||
device == AUDIO_DEVICE_OUT_USB_DEVICE)) {
return 1.0;
}
To
// if volume is not 0 (not muted), force media volume to max on digital output
if (stream == AudioSystem::MUSIC &&
index != mStreams[stream].mIndexMin &&
(device == AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET ||
device == AUDIO_DEVICE_OUT_USB_ACCESSORY ||
device == AUDIO_DEVICE_OUT_USB_DEVICE)) {
return 1.0;
}
- “myandroid/frameworks/base/media/java/android/media/AudioService.java
From
if (SystemProperties.get("ro.product.device").contains("hdmidongle"))
mFixedVolumeDevices &= ~AudioSystem.DEVICE_OUT_AUX_DIGITAL;
To
mFixedVolumeDevices &= ~AudioSystem.DEVICE_OUT_AUX_DIGITAL;
------------------------------------------------------------------------------------------------
Best Regards
Weidong