Using std::promise and std::future to block till A2DP device activated
There is a new interface to replace UIPC with Blueototh Audio Hal v2 and
synchronization issues between BT Stack and Audio Hal was found when
activating a new A2DP device. Because the API to activate an A2DP device
was non-blocking, it was possilbe that there was a race condition when
BT Stack starting A2DP session and Audio Hal was opening A2DP output.
There was a chance that the output was opened before session started and
causing A2DP to have no sound.
This CL uses std::promise and std::future are able to achieve the
serialize of starting session and opening output for A2DP.
Bug:
111519504
Bug:
122505783
Test: A2DP reconnection and switching
Change-Id: I88c42ea1eb5f8def2345dbfaab26c6d1a91c54cc