Repository navigation
[ai] smb: Handle optional Wi-Fi and unavailable local networks. - #4751
Open
carrerasdarren-cell wants to merge 1 commit into
Open
carrerasdarren-cell wants to merge 1 commit into
carrerasdarren-cell wants to merge 1 commit into
Conversation
Wi-Fi is optional in the manifest, so SMB discovery can be opened on devices without a WifiManager. Make its multicast lock optional so Ethernet discovery can still proceed. When no local network is available, explain why discovery cannot start and keep manual entry and cancellation available. Initialize the disposable so this early dialog path dismisses safely. Cover the real dialog flow with synthetic services for unavailable networking, manual entry, cancellation and Wi-Fi/Ethernet controls. Fixes TeamAmaze#4708.
carrerasdarren-cell
force-pushed
the
fix/smb-optional-wifi-4708
branch
from
October 20, 2026 16:08
1635aa8 to
95abd50
Compare
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.
Fixes: #4708
Description
Opening SMB device search can fail while constructing its discovery strategies on a device without the optional Wi-Fi service. Treat the Wi-Fi multicast lock as optional so NSD discovery remains available over Ethernet. When the existing local-network check reports no connection, show an explanation and retain manual hostname entry and cancellation. Initialize the disposable so that this early dialog path can close safely.
The existing
NetworkUtilinterface-name fallback remains unchanged. This is not a universal offline detector; actual hardware discovery is outside the validation below.Issue tracker
Fixes #4708. The related Android TV manifest work in #4705 is already merged; this change handles the runtime SMB dialog and optional Wi-Fi service.
Automatic tests
Added unit tests for specific individual functions
Added headless tests for new app functionality
Added emulator tests for new UI elements
Reproduced the missing-service failure on exact original
94afab32: one selected realMainActivity/DialogFragmentcase fails withnull cannot be cast to non-null type android.net.wifi.WifiManagerthrough the NSD strategy and SMB search dialog.:app:testFdroidDebugUnitTest --tests '*SmbSearchDialogNetworkAvailabilityTest' --tests '*NsdManagerDiscoverDeviceStrategyTest' --tests '*SmbConnectDialogTest' --tests '*NetworkUtilTest' --tests '*SmbDeviceScannerObservableTest': 117 passed, 0 failures/errors/skips on the final source. This includes 15 new dialog cases and 102 existing cases across configured SDKs 21, 28 and 30: manual SMB 9, NetworkUtil 18, NSD 45, scanner 30.New real-dialog controls cover the unavailable-network explanation, manual entry, cancellation, Ethernet discovery without a Wi-Fi manager, and the normal Wi-Fi multicast-lock lifecycle. Services and addresses are synthetic; the other scanner strategies receive no local address, and no real discovery traffic is sent.
The local runner placed caches/reports on the SSD, serialized workers, and passed
--add-opens=java.base/java.net=ALL-UNNAMEDto the JDK 17 test JVM for the existing MockKNetworkInterfacetests. Owner build inputs, dependencies and fail-fast behavior were unchanged. An initial mock-setup mismatch and the initial JDK module-access failure are excluded from the passing evidence. The final message was refined to “local network” to include supported transports such as USB/rndis, then the same 117 cases were rerun successfully.Manual tests
Done
Device: Not performed; validation is headless Robolectric.
OS: No emulator or physical-device validation, screenshots or human review claimed. No device settings were changed.
Build tasks success
Successfully ran the following owner tasks locally on the same final source:
./gradlew assembleDebug— both F-Droid and Play debug APKs built; packaging readback confirms the debug package and optional Wi-Fi declaration../gradlew spotlessCheckGenerative code
This PR used generative code tools (GenAI, LLMs, etc.)
Model: OpenAI Codex coding assistant
Version: Exact runtime model version is not independently exposed in this session.
Provider: OpenAI