OSDN Git Service

A2DP: Do the connection task in the stack main thread
authorCheney Ni <cheneyni@google.com>
Tue, 31 Mar 2020 10:38:49 +0000 (18:38 +0800)
committerMyles Watson <mylesgw@google.com>
Wed, 1 Apr 2020 21:09:37 +0000 (21:09 +0000)
commit367c497abbc0ff5551a1b3210db35ad6540e2dfe
tree12efecf749bf77ae145676af539dbbee4b2a6955
parent6d8321b0b1f1c801aac38ab8cea0442302e4036b
A2DP: Do the connection task in the stack main thread

There is a profile queue to handle connection tasks sequentially, and
invokes the connect API in JNI thread while the previous task finishes.
However, since BtifAvStateMachine is running in the stack main thread,
it brings a race condition about the BtifAVPeer object between the JNI
and stack main threads. This change does A2DP connection task in the
main thread, so has no such race conditions.

Bug: 152595833
Test: make sure the opening event is in main thread manually
Change-Id: Ib40dc7c5fa3e839a894d6f7947ac8266eacd2022
btif/src/btif_av.cc