14 State Machines That Must Agree for Bluetooth to Work
summary
Android Bluetooth requires 14 state machines to reach consistent states for simple connect/pair flows, not just one. The stack uses the state-machine base class plus a handler looper FIFO message model and a typical 10 second timeout to avoid phantom connected states; codecs negotiated are LDAC/AAC/SBC and LE Audio moves to LC3 with multi‑streaming. Debugging relies on Bluetooth dumps + HCI logs + logcat, unit/mock loopers, and CLI-driven end‑to‑end tests; these patterns cut false positives and codec deadlocks in practice.
AI-written summary · about
chapters (16)
- 0:00Bluetooth state machines intro
- 2:08Android Bluetooth stack
- 3:57State machine basics
- 6:1014 state machines explained
- 6:55Foundation state machines
- 11:30Audio pipeline state machines
- 14:25LE audio and GATT state machine
- 17:20Thread safety patterns
- 19:49Observer pattern sync
- 21:40Registry pattern coordination
- 22:42Bluetooth failure modes
- 26:16Debugging with dumps
- 28:04Key takeaways
- 29:32Q&A
- 32:26Timeout strategies
- 34:56Resources and future
related talks
40mState of Bluetooth LE on Android in 2023
35mState of BLE on Android in 2022
34mBluetooth Low Energy in Android: Getting it Done
38mBluetooth LE for Modern Android Development
46mBluetooth Low Energy on Android: Top Tips for the Tricky Bits
41mEVERYTHING IS BETTER WITH(OUT) BLUETOOTH
31mAn introduction to Bluetooth mesh for Android developers
25mKeeping Up Continuous Development of BLE-Based Apps
