Skip to content

K2GO-587 fix(clone): keep the phones in reach on a shared Wi-Fi - #811

Merged
luisguzman-adfa merged 6 commits into
mainfrom
fix/K2GO-587-clone-wifi-default
Nov 20, 2026
Merged

luisguzman-adfa merged 6 commits into
mainfrom
fix/K2GO-587-clone-wifi-default

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

What changes

  • Send starts on the Wi-Fi network when the sender phone is on a Wi-Fi network (HotspotMode.initialFor). With no Wi-Fi network, it starts the hotspot as before.
  • The receiver repairs a dead direct link. New SenderReach.connect: when the paired sender does not answer, the receiver drops the direct Wi-Fi link (TDLS) to the sender and tries once more, through the router. The gateway (router or the sender hotspot) has no direct link, so there is no repair there.
  • The Clone Wi-Fi row (CloneLinkRows) and the pull (SyncStateViewModel) use the same SenderReach.connect. One repair try per sender, again after a "yes".

Why

On a shared Wi-Fi, two phones set up a direct link (TDLS) by themselves under traffic. When the sender then starts a Wi-Fi Direct group (the hotspot), some drivers end their side of that link without telling the receiver. The receiver keeps sending into the dead link: "Sender not found" until Wi-Fi restarts. Reproduced on OnePlus 7T (sender) + Samsung A16 (receiver).

Steps to QA

Baseline (main): both phones on one router Wi-Fi. Sender: Clone > Send (hotspot starts). Receiver: scan the code. Copy over Wi-Fi to the receiver, stop, Send again: the receiver shows "Sender not found" and stays there until Wi-Fi is turned off and on.

Change:

  1. Both phones on one router Wi-Fi. Sender: Clone > Send. Expect: the Wi-Fi row shows the network, no hotspot.
  2. Receiver: scan the code. Expect: "Linked", the copy runs over the router.
  3. Phone with no Wi-Fi network: Clone > Send. Expect: the hotspot starts as before.

Verifications

  • Evidence is in the Jira ticket K2GO-587.
  • Unit tests: HotspotModeTest; full suite passes (:app:testStandardDebugUnitTest).
  • Deferred: retest of the last commit on 7T + OPPO.

Notes

  • setTdlsEnabled(peer, false) is a one-time teardown in AOSP (WifiNative.startTdls): no state stays off, so nothing to undo when the receiver leaves Clone.
  • No new strings, no new permissions (CHANGE_WIFI_STATE is already in the manifest).

Send starts on the Wi-Fi network when the phone is on one, so no Wi-Fi
Direct group starts for nothing. That group can end a direct Wi-Fi link
(TDLS) to the receiver on one side only. The receiver now drops a dead
link to the sender and checks a "no" again.
The gateway (router or the sender hotspot) has no direct link, so SenderReach skips the repair there for every caller. A new sender gets a new repair try.
@luisguzman-adfa luisguzman-adfa added the ui change or edit to UI label Nov 20, 2026
PING every 1 s, three missed PINGs close the link. The cable row showed Linked for 6 to 8 s after the sender app stopped.
@luisguzman-adfa

Copy link
Copy Markdown
Collaborator Author

Added commit a526f33: the cable keepalive finds a lost peer in 3 s, not 6 s
(PING every 1 s, three missed PINGs close the link). Before, the cable row showed
"Linked" for 6 to 8 s after the sender app stopped.

QA on OnePlus 7T (host) + OPPO (accessory): force-stop the sender app; the
receiver closes the link after about 2 s (main: 6.5 s). A full 6.5 GB Clone over
cable plus Wi-Fi finished with no false close.

DirectLinkRepair (pure JVM, tested): repair only when the sender does not answer (a refusal proves the link works), never toward the gateway, once per run of failed checks. During a copy a 'no' is checked again only while its repair is unused.
PeerAlive owns PING_MS; DEAD_MS = 3 * PING_MS.
The reachability warning at pull start lost the reason when SenderReach replaced the inline socket check.
@luisguzman-adfa
luisguzman-adfa merged commit fa969e3 into main Nov 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui change or edit to UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant