Use resolveInstanceName in NsdService

For resolve requests, specify the resolveInstanceName in
MdnsSearchOptions.

This will cause discovery to send followup queries when TXT/SRV/A/AAAA
records are missing; for example if only a PTR record is returned
following the discovery probes, or if no discovery probe is sent at all.

Test: atest NsdServiceTest
Bug: 267570781
Change-Id: Ib18c3afbd1533ada7a78dd8ccac993adb439d014
This commit is contained in:
Remi NGUYEN VAN
2023-02-27 12:18:27 +09:00
parent 42b1042f36
commit bb62b1de50
2 changed files with 5 additions and 2 deletions

View File

@@ -981,7 +981,9 @@ public class NsdServiceTest {
waitForIdle();
verify(mSocketProvider).startMonitoringSockets();
verify(mDiscoveryManager).registerListener(eq(constructedServiceType),
listenerCaptor.capture(), argThat(options -> network.equals(options.getNetwork())));
listenerCaptor.capture(), argThat(options ->
network.equals(options.getNetwork())
&& SERVICE_NAME.equals(options.getResolveInstanceName())));
final MdnsServiceBrowserListener listener = listenerCaptor.getValue();
final MdnsServiceInfo mdnsServiceInfo = new MdnsServiceInfo(