Repository navigation
Conversation
…or USB An emulator and a wireless-debugging phone have no colon in their serial, so the 'contains :' rule called both USB: logged as USB, shown with Go Wireless and Handoff, and accepted by the daemon (an emulator's adbd was restarted and the host's LAN gateway probed). AdbTransport now tells usb, network, mdns and emulator apart; the daemon sends it with every device, refuses Go Wireless, Handoff and USB-only where they do not apply, and the UI follows the same rules.
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.
Refs #28
What
One classification of how adb reaches a device (USB,
ip:port, wireless debugging, emulator), used by the daemon and the UI, so Go Wireless and Handoff are offered only for a phone on USB.Why
isNetworkwas "serial contains:". A wireless-debugging serial (adb-<serial>-<suffix>._adb-tls-connect._tcp) and an emulator serial (emulator-5554) have no colon, so both were treated as USB: logged "connected via USB", listed with Go Wireless and Handoff in the UI, and accepted by the daemon. Reproduced against a real emulator before the change: Go Wireless foremulator-5554was accepted, restarted the emulator's adbd, then triedadb connectto the host's LAN gateway (192.168.1.1:5555) and to10.0.2.16:5555.How
AdbTransport { usb, network, mdns, emulator }in core, withAdbTransport.of(serial).emulator-<digits>is an emulator;adb-<serial>-<suffix>._adb-tls-connect._tcpis mDNS; anything else with a colon is a network address (IPv4, bracketed IPv6); the rest is USB. Lookalikes (emulator-abc,adb-...without the service name, the pairing service) fall to USB rather than guess.AdbDevice.transport,canGoWireless(USB only) andhardwareSerial(USB: the serial; mDNS: the embedded part; network and emulator: null, since an emulator'sro.serialnois not its adb serial).isNetworkkeeps its meaning for existing callers: anip:portaddress.devicessnapshot carriestransport(additive; the UI parser ignored unknown keys). Go Wireless and Handoff are refused for anything but USB with a reason (started: falseplus afailedstatus event) before anything is sent to adb. The log says how each device is connected.u(USB-only) is refused for mDNS and emulators over IPC and skipped by theukey; forip:portit now splits host and port at the last colon, so a bracketed IPv6 address works. Thewandhkeys pick only USB phones.Device.transportis what the daemon reports, with a fallback worked out from the serial for a daemon that sends none (the same rules, tested on the same serials as core). Go Wireless and Handoff show only for USB; the other kinds are labelled (wireless,wireless debugging,emulator).hardwareSerialexists for Same physical phone gets multiple concurrent scrcpy instances across USB/wireless serials (confirmed, with zombie process accumulation) #4 but nothing uses it yet.Verified by
Physical phone (Pixel 10a) and a real emulator, both tested live. All with an isolated daemon config and
autoLaunchoff.google_apis_playstorex86_64) on a separate adb server on port 5038, never the owner's server on 5037. The AVD, emulator and server were removed afterwards; nothing else was changed.emulator-5554;ro.kernel.qemu=1;ro.serialnoEMULATOR36X4X9X0(differs from the serial).transport: emulatorand logs "connected via emulator". Go Wireless, Handoff and USB-only for it are refused with a reason. The emulator was untouched: same adb transport id before and after, no TCP port opened.adb tcpipandadb connect 127.0.0.1:5555adb lists the same emulator twice (emulator-5554and127.0.0.1:5555, samero.serialno). That is Same physical phone gets multiple concurrent scrcpy instances across USB/wireless serials (confirmed, with zombie process accumulation) #4, not changed here.transport: mdns, logs "connected via wireless debugging", Go Wireless and Handoff refused with a reason, phone untouched (same transport id, no TCP port). Notcpip,usbordisconnectwas run against it.ro.serialnoequals the serial embedded in the mDNS name),ip:portfor this phone (tcpipis off), and how adb answerstcpip/usb:/disconnecton an mDNS transport.tcpipRequestsstays 0), a USB phone still accepted, USB-only refused for emulator and mDNS); ui 57 (+25: the fallback on the same serial list as core, JSON with/without/unknowntransport, which buttons each row shows). ipc 26.dart analyzeandflutter analyzeclean.Risk / follow-ups
transportcase; the two are tied together by the shared serial list, not by code.192.168.1.6cached, phone now192.168.1.8) are Reconnector: backoff, try current gateways, filter non-private gateways #27 / Same physical phone gets multiple concurrent scrcpy instances across USB/wireless serials (confirmed, with zombie process accumulation) #4. Not part of this PR.