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
Loading
Please register or sign in to comment