Default USB Audio volume control option

Dear DariosF,

This is one of the best ROMs I've tested in last 3 weeks and now use it as my primary. I was able to patch services.jar (many thanks to jacknorris) to enable USB DAC hotplug and it worked perfectly. However, there is a common weakness in all ROMs, because there's no option to control AUDIO_DEVICE_OUT_USB_ACCESSORY volume (it's either max or mute). Again, jacknorris proposed a small patch to AudioPolicyManagerBase.cpp, which can deal with this issue:

// 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 ||
device == AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET ||
device == AUDIO_DEVICE_OUT_USB_ACCESSORY ||
device == AUDIO_DEVICE_OUT_USB_DEVICE)) {
return 1.0;
}

If the line shown in red is removed, Android will be able to adjust USB DAC volume, according to jacknorris. However, his volume control patch is not compatible with 4.2.2 and later Android versions (audio_policy.default.so module does not load).

I'm wondering if you may consider implementing this patch in future releases or, maybe, it's possible just to make a custom audio_policy.default.so. Unfortunately, as a noob I do not have necessary skills to compile this module myself.

Thank you again for all your efforts and an excellent ROM.

Happy Holidays!