Skip to content

Conversation

@TranceLove
Copy link
Collaborator

Description

NsdManager implementation of SmbDeviceScannerObservable.DiscoverDeviceStrategy, to enable discover Samba servers advertised on the network using mDNS.

Issue tracker

Fixes #4488

Automatic tests

  • Added test cases

Manual tests

  • Done

  • Device: Fairphone 5

  • OS: LineageOS 23.0 (Android 16)
    With proper configuration of avahi-daemon and samba, Amaze is able to discover Samba servers on the same network.

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements SMB device discovery using Android's NsdManager API for mDNS/Bonjour/ZeroConf service discovery. The implementation follows the existing strategy pattern, adding NsdManagerDiscoverDeviceStrategy alongside the existing WSDD and same-subnet discovery strategies.

  • Adds a new discovery strategy using NsdManager for mDNS-based SMB server discovery
  • Refactors the Observable to properly handle individual emitter disposal and error propagation
  • Adds required Android permissions for multicast and nearby Wi-Fi device access

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
NsdManagerDiscoverDeviceStrategy.kt New strategy implementation using NsdManager to discover SMB services via mDNS, with support for both pre-API 34 (using deprecated resolveService) and API 34+ (using hostAddresses)
SmbDeviceScannerObservable.kt Modified to use Observable.create instead of fromCallable, properly handle emitter disposal, add explicit onSubscribe call, and propagate errors to observers
NsdManagerDiscoverDeviceStrategyTest.kt Comprehensive unit tests for the new NsdManager strategy covering service discovery, resolution, error handling, and resource cleanup
SmbDeviceScannerObservableTest.kt Unit tests for the Observable implementation verifying strategy coordination, device emission, disposal, and error propagation
SmbSearchDialog.kt Minor refactoring: rename mInflater to inflater, replace Color.parseColor with toColorInt extension
AndroidManifest.xml Adds INTERNET (duplicate), CHANGE_WIFI_MULTICAST_STATE, and NEARBY_WIFI_DEVICES permissions for mDNS functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TranceLove TranceLove marked this pull request as ready for review January 2, 2026 00:57
@TranceLove TranceLove force-pushed the feature/4488 branch 3 times, most recently from 39b5957 to a2b6f19 Compare January 4, 2026 02:17
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.

Support mDNS Hostnames in SMB Connection Configuration

1 participant