Wait until A2DP source shutdown completes when active peer is set to the empty address.
Currently, there is a race condition when switching A2DP devices. We first set the active peer to the empty address and then to the newly active device. When the active peer is set to the empty address, we shutdown the A2DP source which takes time. Before that shutdown completes, we try to set the active peer to the newly active device. Since the source has not finished shutting down completely, this request to start a new A2DP source is ignored by the stack. Fix this by waiting until shutdown is complete and A2DP source state is set to kStateOff. This way, when setActivePeer with empty address returns, A2DP source state would already have been set to kStateOff. Bug: 253974905 Tag: #refactor Test: manual by using log patterns Change-Id: I2a51abfd3a68e5efd66dc117fda4b0697816bb04
Loading
Please register or sign in to comment