Skip to content

feat(android): connect live selected NSD candidates to one RVD1 session - #307

Open
turinglambdaai wants to merge 8 commits into
mainfrom
feature/android-selected-companion-coordinator
Open

turinglambdaai wants to merge 8 commits into
mainfrom
feature/android-selected-companion-coordinator

Conversation

@turinglambdaai

Copy link
Copy Markdown
Owner

Scope

  • Introduce SelectedDeviceCompanionCoordinator joining explicit discovery/selected resolution to an authenticated, single-use DeviceCompanionSession.
  • Reject closed pairing windows and stale, removed, or changed candidates before dialing. Run blocking TLS/RVD1 only on a product-owned executor (never on NSD callback thread).
  • Close/cancel pending native resolution, queued dial or active transport; suppress duplicate completion and prevent silent reconnect-to-pairing fallback.
  • Preserve explicit code confirmation, credential persistence and post-acceptance application handoff from existing RVD1 client.
  • Add deterministic JVM tests for successful reconnect, one-shot completion, stale selection, closed pairing, and cancellation before a queued dial.

Validation

CI must pass prior to review/merge; no Android UI, secure-store integration, or real-device evidence claimed. Independent of PR #306. Base 1248a90cdf347edfb44731ff7c8f69c94df96d59.

A resolved endpoint that DeviceCompanionEndpoint rejects threw from the
queued worker task: the guard around worker.execute only covers task
submission, so the shared worker thread died with the callback never
invoked and a product UI waiting forever. Construction now fails through
the same completion path as a failed dial.

Staleness also compared the whole DeviceDiscovery, so a pairing-window
flip between selection and worker start reported STALE_SELECTION for a
device that is still present; presence now matches stable identity
(service name plus listener ID) and the window is judged from the fresh
advertisement, giving Pair intents the PAIRING_WINDOW_CLOSED code.

JVM tests pin the rejected-endpoint callback, reconnect proceeding
across a window flip, and pair failing closed with the right code.
@turinglambdaai
turinglambdaai marked this pull request as ready for review October 22, 2026 15:48
The resolver's validate() rejects out-of-range ports before the
coordinator's worker ever sees an endpoint, so the intended
bad-endpoint scenario completes with STALE_SELECTION synchronously, not
through the worker's construction guard; the guard stays as
defense-in-depth but the test now pins the actual single-shot callback
contract. Local gradle verification needs ANDROID_HOME now that the
android-nsd module compiles in the same build.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant