feat: Android Wi-Fi device pairing (QR + pairing code) with remember/auto-reconnect#30
Draft
DevSrSouza wants to merge 1 commit into
Draft
feat: Android Wi-Fi device pairing (QR + pairing code) with remember/auto-reconnect#30DevSrSouza wants to merge 1 commit into
DevSrSouza wants to merge 1 commit into
Conversation
…auto-reconnect
Pair physical Android devices over Wi-Fi from a sheet in the Devices area,
driving the `adb` CLI — both QR-code and pairing-code modes.
- QR mode: generate service name + password, render the QR (CoreImage), and
auto-pair when the phone advertises `_adb-tls-pairing._tcp` under our name.
- Pairing-code mode: live mDNS discovery list + a manual `ip:port` fallback
(the phone shows it) for networks that block multicast.
- Surfaces adb's failure message instead of failing silently, detects a disabled
mDNS daemon via `adb mdns check`, and offers a one-click `adb kill-server` recovery.
- Remembers paired devices (name, last IP, method, last-seen) in Application
Support and reattaches them in the background when their `_adb-tls-connect`
service reappears — the auto-recover adb skips.
New: Core/Devices/{MdnsService,AdbPairingService,QrPairing,PairedDeviceStore},
Model/PairingModel, Features/Pairing/PairDeviceSheet. Wired into AppModel
(factory + reconnect loop) and DeviceSidebarView (button + sheet).
Tests: Tests/PairingTests.swift covers the pure logic — mDNS parser, PairResult,
MdnsHealth, QR payload/credentials, and the paired-device store (17 cases).
Not yet exercised end-to-end against a physical device.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Pair physical Android devices over Wi-Fi from Jaca — a sheet launched from the Devices area, driving the
adbCLI. Supports both pairing modes plus a remember/auto-reconnect layer that adb itself lacks._adb-tls-pairing._tcpunder our name.ip:portfield (the phone shows it) so pairing still works on networks that block multicast.adb mdns check, and offers a one-clickadb kill-serverrecovery._adb-tls-connectservice reappears.Why
Android Studio's wireless pairing fails silently and doesn't auto-recover or remember devices. This mirrors the official flow (researched against the AOSP
adband Android Studiotools-base/adblibsources) and fills those gaps.Files
Core/Devices/MdnsService.swiftCore/Devices/AdbPairingService.swiftCore/Devices/QrPairing.swiftCore/Devices/PairedDeviceStore.swiftModel/PairingModel.swiftFeatures/Pairing/PairDeviceSheet.swiftModel/AppModel.swiftFeatures/Sidebar/DeviceSidebarView.swiftDesign notes
adb mdns servicesevery ~1s rather than the protobufhost:track-mdns-servicesstream (that stream is new-adb-2025+ only; polling text is universal, sub-second, and trivially testable). Upgrading to the live stream is a possible follow-up.ip:portfallback + targeted remembered-host reconnect cover the mDNS-blocked case instead.Test plan
Tests/PairingTests.swift— 17 cases over the pure logic (mDNS parser,PairResult,MdnsHealth, QR payload/credentials, paired-device store + reconnect join). All green.🤖 Generated with Claude Code