fix(android): pass PROTOCOL_DNS_SD so mDNS registration works
Android 16 added NsdManager.checkProtocol(): registerService with protocol 0 threw IllegalArgumentException: Unsupported protocol — silently, since the old code swallowed the exception into a dead reflection fallback and start() overwrote the failure status with the Listening line. mDNS never actually advertised (the Phase 8 session streamed via --peer, masking it). Also advertise after the listening status so a registration failure stays visible, and log the exception and the registration success. Validated live on the Fairphone 6: the desktop --discover lists the phone and a full --send session decodes (in-band SPS 320x240 -> 2496x1040) and renders.
This commit is contained in:
@@ -240,6 +240,16 @@ Platform quirks found while validating (Android 16 / API 36):
|
||||
|
||||
- `android.permission.INTERNET` is required — NsdService rejects
|
||||
registration without it.
|
||||
- `NsdManager.registerService` on Android 16 validates the protocol
|
||||
argument (`NsdManager.checkProtocol`): the historical `0` throws
|
||||
`IllegalArgumentException: Unsupported protocol` — pass
|
||||
`NsdManager.PROTOCOL_DNS_SD`. This was silent for a long time: the app
|
||||
swallowed the exception and the failure status was overwritten by the
|
||||
"Listening…" line, so mDNS never advertised even though the UI looked
|
||||
fine (discovery only worked via `--peer`). Diagnosed via
|
||||
`adb shell dumpsys servicediscovery` (the client's `mClientRequests`
|
||||
stays empty when no request was ever issued) plus logging the
|
||||
exception.
|
||||
- `DatagramSocket.localPort` gives the bound port; `.port` is -1 for
|
||||
unconnected datagram sockets, and `.localAddress` is an `InetAddress`
|
||||
(Inet6Address on Android), not an `InetSocketAddress`.
|
||||
|
||||
Reference in New Issue
Block a user