You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mobile: discovery keeps running after connect, holding the WiFi MulticastLock for the whole session #359
Found on: real device — Samsung SM-A166U1 (Galaxy A16 5G), Android 14 / API 34. App v3.3.0 (6537a3d). On-device session 2026-09-12.
What a user does
Taps Scan for devices, then taps a device to connect.
What happens
The scan keeps running. The button still reads "Stop scanning" after a successful connect, and the WifiManager.MulticastLock taken for discovery stays held for the rest of the session.
Measured with adb shell dumpsys wifi:
# during the scan
Multicast Locks held:
Multicaster{daqifi-discovery uid=10265}
mMulticastEnabled 2 / mMulticastDisabled 1
# after tapping the device and connecting successfully
Multicast Locks held:
Multicaster{daqifi-discovery uid=10265}
mMulticastEnabled 3 / mMulticastDisabled 2
Starting a stream does stop it (the scan button disappears), but stopping the stream starts discovery again while still connected, and the lock is retaken.
The lock itself is correctly balanced — an explicit Stop scanning releases it and the counters settle even (verified: Multicast Locks held: empty, 2/2). So this is not a leak. It is discovery running when there is nothing left to discover.
Why it matters
MulticastLock exists to stop Android power-save-filtering incoming broadcast/multicast — which is the whole point of MulticastDiscoveryScope, and why the manifest carries CHANGE_WIFI_MULTICAST_STATE:
Required to hold a WifiManager MulticastLock — without it Android power-save-filters incoming UDP broadcast and discovery finds nothing.
Holding it continuously keeps that filtering off for the entire connected session, on a battery-powered device, alongside the WifiLock{daqifi:streaming type=4} (FULL_HIGH_PERF) the streaming service already holds. The broadcast traffic also keeps going out for a device the user has already chosen.
What should happen
A successful connect ends the discovery sweep and releases the lock, the same way starting a stream already does. Re-scanning stays available — the user can tap Scan again — and after a stream stops, discovery should not restart on its own while a device is still connected.
Severity: low
Nothing is broken or unreachable and no resource leaks. It is wasted radio and battery on a phone, and a "Stop scanning" button offering to stop something the user has no reason to think is still running.
Activity