Added a workarouond to request the A2DP output standby directly to audio hardware when the sink is suspended as it seems that the suspend request often fails.
Also take into account resume requests received while a suspend request is pending.
Apparently the problem is caused by the fact that A2dpAudioStreamOut::standby() calls a2dp_stop() after the headset has been powered down.
The workaround consists in indicating to A2DP audio hardware that a close request is pending and that stanby() must be bypassed.
Initial commit for review.
Integrated comments after patch set 1 review.
Fixed lockup in AudioFlinger::ThreadBase::exit()
Fixed lockup when playing tone with AudioPlocyService startTone()
Take mutex in close(), and skip write path after turning bluetooth off.
Original author: npelly
Merged from: //branches/cupcake/...
Automated import of CL 144151