Skip to content

Add a network self-check to Diagnostics - #190

Merged
easonxiang merged 1 commit into
mainfrom
issue-189
Oct 4, 2026
Merged

easonxiang merged 1 commit into
mainfrom
issue-189

Conversation

@easonxiang

Copy link
Copy Markdown
Contributor

Fixes #189

What changed

  • About → Diagnostics → Run network check (no new screen). Each item shows Pass, Problem or Can't verify, what was found and, where useful, a next step:
    • Receiver: running / off / stopped with an error (the error text)
    • Network: Wi-Fi (with SSID when Android reveals it) or Ethernet plus IPv4 address; other network types, no address yet, or no answer within 2 s are Can't verify
    • _airplay._tcp and _raop._tcp on their own: registered (port) / waiting for Android / failed (NsdManager code and meaning) / not advertised
    • AirPlay listener: the port the native receiver reported; a Problem when only the discovery probe is up; Can't verify while the receiver is off
    • Last discovery failure: service type, time and error code; still listed but Pass once both services have registered again
    • Phone and TV on the same network: always Can't verify, with guidance (same non-guest Wi-Fi, AP/client isolation off, no VPN on the phone)
  • AirPlayDiscoveryAdvertiser keeps each registration's state and the latest failure (DiscoveryStatus), including after it stops itself on a failure, and records failures as discovery events. AirPlayManager.snapshot() exposes it with the receiver state and listener port.
  • The check only reads state. It never stops or restarts AirPlay or DLNA. Each run is recorded as a check event.
  • NetworkCheck.classify is pure and unit-tested. The UI maps its reasons to strings (English and Simplified Chinese).
  • The Diagnostics header buttons now wrap (FlowRow) under the title, because three buttons in one row pushed Upload/Clear off a phone-width screen.

No restart action was added, as the issue asks.

Tested

  • ./gradlew assembleDebug :app:testDebugUnitTest :app:lintVitalRelease passes. NetworkCheckTest has 9 tests covering classification and state mapping, and checks NsdManager codes against the SDK constants.
  • Emulator (emulator-5554, Android 16, phone size), debug build via tools/sim:
    • Ran the check with a tap and with the D-pad (focus on the button, OK, then down through each result row).
    • Results: receiver, Wi-Fi 10.0.2.16, both services on port 7000, listener 7000 and no failures all Pass. The same-network item shows Can't verify.
    • The log shows no receiver stop or start when the check ran.
  • Not exercised on a device: the failure and discovery-only paths (unit tests cover them) and the Chinese strings on screen.

Device checks left for review

  • On a TV (Google TV, and the Android 6 Xiaomi for the API 23 path), with the remote: open Diagnostics, run the check, and scroll through the results.
  • Run the check while an iPhone is mirroring or playing music, and confirm the cast continues.
  • Look at the results in Chinese.
  • On a car head unit or tablet: Ethernet / Wi-Fi detection, and whether the SSID appears when the location permission is granted.

🤖 Generated with Claude Code

When an iPhone, iPad or Mac can't find CastBay, the person had no way to
tell from the TV whether the receiver, the network or the router was at
fault. Run network check on About → Diagnostics now reports, item by
item, Pass / Problem / Can't verify with a next step: the receiver's
state, the network type and IPv4 address, each DNS-SD registration
(_airplay._tcp and _raop._tcp) on its own, the AirPlay listener's port,
and the latest registration failure with NsdManager's error code.

The check only reads state, so it never restarts the receiver or
interrupts a cast. The advertiser now keeps each registration's outcome
and its latest failure after it stops (it stops itself on a failure),
and records failures among the Diagnostics events. What only the phone
or router can know, such as AP/client isolation, is always shown as
Can't verify. The header buttons wrap so a third fits on narrow screens.

Co-Authored-By: Claude <noreply@anthropic.com>
@easonxiang
easonxiang merged commit 7b4b6fd into main Oct 4, 2026
6 checks passed
@easonxiang
easonxiang deleted the issue-189 branch October 4, 2026 13:40
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.

Add a network self-check to Diagnostics

1 participant