floss: Suspend: Wait until ACL really disconnected
This fixes an issue that the fake disconnected events triggered by disconnect_all_acls could be earlier than the SCO disconnected events, then some HFP control blocks would be unexpectedly cleared and breaks the cleanup process. Historically we call le_rand to make sure all HCI commands are done (see https://r.android.com/2053066), but it is not reliable enough because there could be events other than Command Complete or Command Status that wake the device up. Eventually, a 100ms delay was added. This patch removes le_rand and introduces a refactor in suspend.rs: - The 100ms delay is kept as an independent task to decrease the complexity of the other task(s) and make sure they won't affect each other. - Additionally we wait for ACL disconnect complete event. We don't set the event mask now because that would break the state machine in LibBluetooth. - Finally suspend_ready is responsible for making sure the above tasks have finished, then send out suspend signal. Bug: 385279302 Tag: #floss Test: mmm packages/modules/Bluetooth Test: bluetooth_AdapterSRHealth.all_floss Test: Create a SCO/A2DP and suspend the DUT. After resume, both A2DP/SCO works fine. Flag: EXEMPT, Floss-only change Change-Id: I1aa0dd075c83e4d449a253af4c99445d11f39f99
Loading
Please register or sign in to comment