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.
If the output stream handler passed was not the A2DP output stream, the request was ignored instead of being forwarded downstream to hardware interface.
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