Improve watch reconnect handling on GrapheneOS#148
Improve watch reconnect handling on GrapheneOS#148and1mon wants to merge 2 commits intoizivkov:mainfrom
Conversation
|
Yeah I totally get that, it is a big change and I cannot reliably test it for all devices. The retry logic is also not my preferred way of solving this, however so far it has been the only way I got it work. There is no need to merge this as is, maybe it can help find a cleaner solution though. |
|
|
Slimmed down the PR to only include the necessary logic without a bigger refactor as before, so hopefully it's a bit better to read now for further analysis. |
|
So, you are right - the GrapheneOS is eating "onDeviceAppeared" events and we cannot rely on the CDM generated events alone. I have incorporated ideas from your Pull Request and other AI feedback into a branch grapheneos. Please check it out and try it. I'm pretty confident it will work on GrapheneOS. You can take a look at the release notes in this file on this branch: RELEASE_NOTES_GRAPHENEOS.md Let me know how it goes, |



Summary
This changes reconnect handling so the app no longer depends primarily on CDM/CompanionDevice presence events to reconnect to a previously paired watch.
On GrapheneOS, the initial pairing/connection worked, but later reconnect attempts after a watch-side disconnect were often not detected unless the watch was paired again. The root issue appeared to be that the app was not reliably receiving a fresh reconnect trigger from the OS.
What changed
ReconnectManagerto centralize reconnect state and policyBLUETOOTH_SCANfor the scan fallback path on Android 12+Why
The reconnect itself was able to succeed once started. The failure mode was that, after a disconnect, the app often did not notice a later reconnect attempt from the watch on GrapheneOS.
This PR makes reconnect detection more app-driven and less dependent on ROM-specific CDM behavior.