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

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

floss: Decouple set connect/discoverable functions and revise the suspend/resume code

The current code has some issues:
- On resume we only restore the previous connectable mode, but the peer
  status may have changed so trigger_update_connectable_mode would be
  preferred.
- If device was discoverable before suspend, it would be restored
  without a timeout after resume. Which means the device would be
  discoverable forever.
- Set connectable mode to false would always reset discoverable mode.
  This becomes an issue because we now adjust the connectable mode often
  and it also makes it hard to resolve the previous issues.

This patch does:
- Decouple the set connect/discoverable functions. Set connectable would
  be no-op if the device is discoverable. On discoverable timeout, the
  connectable mode would be restored.
- Implement enter/exit suspend function for scan mode. Properly handle
  the set connect/discoverable functions when device is suspending.
- Since the set connect/discoverable functions are decoupled, we could
  also prevent sending the redundant connectable mode to LibBluetooth.

Bug: 336881286
Tag: #floss
Test: mmm packages/modules/Bluetooth
Test: Tauto: SAHealth, CLHealth, SRHealth on Nipperkin upstream Floss
Test: Tauto: SAHealth, CLHealth, SRHealth on Nipperkin local Floss
Test: manual PhoneHub / SmartLock / NearbyShare HighVis / Fast Pair
Test: manual Classic peer + suspend resume
Test: manual verified a short discoverable timeout correctly reset the
      scan mode after suspend/resume
Flag: EXEMPT, Floss-only changes
Change-Id: I588b70dc6d9816cd211f9cab16ddff6f3c9ee302
parent d362b840
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