Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit bbea43c6 authored by Hsin-chen Chuang's avatar Hsin-chen Chuang
Browse files

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
parent 78e41009
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment