Commit Graph

87 Commits

Author SHA1 Message Date
Treehugger Robot
dba0dbc7ec Merge "Add test for downstream tethering" into main 2023-09-13 01:01:32 +00:00
Yuyang Huang
fca402abed Add test for downstream tethering
Add end-to-end testing for testing NsdManager advertising and
discovering works fine with downstream tethering interfaces.

Bug: 281639507
Test: atest NsdManagerTest
Change-Id: I5a66423f216cfe0c82db5128502c885980ab264b
2023-09-12 17:53:37 +09:00
Paul Hu
508a012b2e Correct isLegacy metric data
The isLegacy field of Nsd metrics should indicate whether the
data was collected from the old backend or not. However, it is
currently only dependent on the ENABLE_PLATFORM_MDNS_BACKEND
compat change value, which is incorrect. This is because the
NsdService always uses the new backend since Android U,
regardless of the compat change value. Therefore, the isLegacy
data should be obtained from each transaction.

Bug: 287546772
Bug: 299880473
Test: atest FrameworksNetTestCases NsdManagerTest
Change-Id: I156abd656b90578d710696a69ccf7dfca97a2c9c
2023-09-12 01:20:00 +00:00
Yuyang Huang
169de9c8a1 Merge "Add Chicken bit for the mDNS offload feature" into main 2023-09-08 13:25:53 +00:00
Yuyang Huang
b96a071f51 Add Chicken bit for the mDNS offload feature
Bug: 297482971
Test: TH
Change-Id: I6f2cdd066d9047b113ff80211cf6d4c6fa605104
2023-09-08 17:42:26 +09:00
Motomu Utsumi
3e0be398a2 Remove unnecessary arguments from isTetheringFeatureEnabled
This CL also updates not to use isTetheringFeatureEnabled for
TETHER_FORCE_UPSTREAM_AUTOMATIC_VERSION which is wrongly configured in
Connectivity namespace.

Test: m
Bug: 279108992
Change-Id: If4f3a57c749bbaeb85454c31248c5bc5feaab936
2023-09-08 16:11:28 +09:00
Paul Hu
043bcd4537 Report more advertising metrics data
Report more advertising metrics data below when the service is
unregistered.
- Replied request count (sum across interfaces)
- Sent packet count (including announcements and probes)
- Number of conflicts during probing
- Nubmer of conflicts after probing

Bug: 287546772
Test: atest FrameworksNetTestCases NsdManagerTest
Merged-In: I50c54a35dc523422e3a7302c059bbbc38eac5631
Change-Id: I50c54a35dc523422e3a7302c059bbbc38eac5631
2023-09-06 11:26:53 +08:00
Yuyang Huang
65f96123a2 Merge "Update permission check for offloadEngine registration" into main 2023-09-05 08:45:39 +00:00
Yuyang Huang
2be259b9cf Merge "Send OffloadServiceInfos when registerOffloadEngine is called" into main 2023-09-05 07:05:05 +00:00
Yuyang Huang
8e6fbc8c1a Update permission check for offloadEngine registration
For an app to register itself as an offloadEngine, it must have either
of the following permissions: NETWORK_STACK,
PERMISSION_MAINLINE_NETWORK_STACK, NETWORK_SETTINGS,
REGISTER_NSD_OFFLOAD_ENGINE.

Bug: 294777050
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I19fe9b996a02b1ae23116c02a1b8406d93b3ecf1
2023-09-05 14:53:51 +09:00
Yuyang Huang
c275a9e7ef Send OffloadServiceInfos when registerOffloadEngine is called
When the OffloadEngine is registered, it should get notice about all the
currently offloaded service.

Bug: 297314970
Test: atest CtsNetTestCases
Change-Id: I1b977a40476a1f5c30a075b559e72656a42865ae
2023-08-31 17:44:28 +09:00
Paul Hu
1b5d601d0c Merge changes I47b91c0c,I630c0e49 into main
* changes:
  Report sent query count
  Report service info callback metrics data
2023-08-25 14:46:39 +00:00
Paul Hu
bad6fe9835 Report sent query count
Report the sent query count when the discovery is stopped.

Bug: 287546772
Test: atest FrameworksNetTestCases NsdManagerTest
Change-Id: I47b91c0c530eee2f00920ee5ea99e8d7b6e2e9ee
2023-08-22 17:26:27 +08:00
Paul Hu
ddce5919af Report service info callback metrics data
Bug: 287546772
Test: atest FrameworksNetTestCases
Change-Id: I630c0e4921f7acf42bf29812d9790ee5a894d60b
2023-08-22 15:25:37 +08:00
Motomu Utsumi
cad1226991 Merge "Rename to isTetheringFeatureEnabled" into main 2023-08-21 03:17:38 +00:00
Paul Hu
6014905672 Report resolution stop
Report the nsd metrics event of resolution stop.

Bug: 287546772
Test: atest FrameworksNetTestCases
Change-Id: I2e6de22c946d58a3410f16b2f2689fd3ffc635a4
2023-08-18 11:59:06 +08:00
Motomu Utsumi
624aeb4274 Rename to isTetheringFeatureEnabled
DeviceConfigUtils has isFeatureEnabled for NetworkStack and Tethering
which were confusing since the difference was only the arguments.
This CL renames isFeatureEnabled for Tethering module to
isTetheringFeatureEnabled to avoid confusion.

Bug: 279108992
Test: m
Change-Id: I05255bb38619afbe621d29524d7910d206a149f1
2023-08-17 17:47:19 +09:00
Paul Hu
a6bc463155 Report resolution metrics data
Collect information on resolution success and failure events,
then use this data to build metrics and report them.

Bug: 287546772
Test: atest FrameworksNetTestCases NsdManagerTest
Change-Id: I373ce91fea9d5a278f53fc0c505be90dd39b2d5b
2023-08-16 15:53:06 +08:00
Paul Hu
812e9217b9 Report discovery metrics data
Collect information on discovery start, failure, and stop events,
then use this data to build metrics and report them.

Bug: 287546772
Test: atest FrameworksNetTestCases NsdManagerTest
Change-Id: I2f6a718024870f9658cfeabe8995624a3ad81f05
2023-08-16 15:09:17 +08:00
Paul Hu
101dbf5262 Fix NullPointerException on NsdService
The NsdService will throw a NPE if a new client is registered
with a null INsdManagerCallback object. To avoid this, perform
a null check before registering a new client and throw an
IllegalArgumentException if the callback is null.

Bug: 293285797
Test: atest FrameworksNetTests
Change-Id: Id61e27873591031c3fe383879aee0d40eebc08b3
2023-08-10 14:19:01 +08:00
Yuyang Huang
7ddf2935f9 Replace usage of android.util.Log to SharedLog
Bug: 294326360
Test: atest FrameworksNetTests
Change-Id: I9a3a84f907362260bdcf6be19e2c4d5345788d2e
2023-08-06 17:34:50 +09:00
Yuyang Huang
33fa4d268c Add callbacks for service offload
Components that can provide offload like IpClient (packet
filter offloading) can use the API to register a callback to be notified
when offload is necessary.

Bug: 269240366
Test: atest CtsNetTestCases
Change-Id: I8080702f5b530001b88e79e504f4722ac01bc576
2023-08-04 19:22:15 +09:00
Paul Hu
777ed05c73 Report registration metrics data
Collect information about registration successes, failures, and
unregistrations, then build metrics data from this information
and report it.

Bug: 287546772
Test: atest FrameworksNetTestCases NsdManagerTest
Change-Id: I6324279b479da2e61b7519d96df5ad24a432e54a
2023-07-24 14:50:48 +08:00
Paul Hu
cdef353532 Add NetworkNsdReportedMetrics
Add helper class NetworkNsdReportedMetrics to build and report
nsd metrics data.

Bug: 287546772
Test: m
Change-Id: I8271811c52a88329fd54e8e0f6cc455d3a3d22f7
2023-07-20 16:35:50 +08:00
Paul Hu
d44e1b721d Rename some variables in NsdService
- This is a no-op change change that only unify the naming of
  transaction IDs. Because there are currently different naming
  conventions for transaction IDs, which can cause confusion and
  lead to errors.
- Also renaming the "client ID" to "client request ID" because
  this more accurately reflects how the ID is used.

Bug: 287546772
Test: m
Change-Id: I4fb7255f23754aa720a83a5df282700c59140207
2023-06-28 17:49:25 +08:00
Paul Hu
83ec7f4cae Add more logs for debugging
There is no log to show whether the callbacks have been sent to
user. So add some logs on NsdService to at least know whether
the callback was sent to NsdService.

Test: atest FrameworksNetTests android.net.cts.NsdManagerTest
Change-Id: I1940d501ac3f9f56ce440366d0b5214a97d6f6f7
2023-06-07 18:04:09 +08:00
Remi NGUYEN VAN
a8efbe0e32 Take the multicast lock on mDNS usage
When an mDNS request (discovery, advertising, resolving...) is
registered and gets assigned a socket on a wifi network, take the
multicast lock to ensure that it can reliably receive mDNS responses.

This is limited to when the application has importance
FOREGROUND_SERVICE or higher.
NsdManager is not documented to require usage of the multicast lock,
which has caused various reports about its reliability. Taking the lock
while the app is in the foreground should address the large majority of
cases, while limiting battery impact.

Going forward this should allow developers on U+ to not take the
lock themselves, allowing optimizations on devices supporting APF,
where instead of taking the lock APF would let through only select
mDNS packets.

Bug: 284389438
Test: atest
Change-Id: I1ce85220eac4a1529b6716d50727c1c462356846
2023-06-06 11:13:34 +09:00
Yuyang Huang
ff96322c4f Turn on removeExpiredService feature
Turn on removeExpiredService feature by: 1) Remove the unnecessary
allowSearchOptionsToRemoveExpiredService flag. 2) Turn on the
removeExpiredService flag in the MdnsSearchOptions.

Bug: 285260665
Test: atest CtsNetTest FrameworksNetTests
Change-Id: Ib115b40e70b0f81a7877deb73af7d61e2e0c385f
2023-06-02 12:33:55 +09:00
Yuyang Huang
243d1a5de4 Add MdnsDiscoveryManager constructor without looper
In some use cases for the MdnsDiscoveryManager, providing looper as an
argument to the MdnsDiscoveryManager constructor is not feasible. Adding
a constructor without looper can help to match those use cases. If
constructor without looper is used. The shutDown() must be called as a
part of cleanup process.

Bug: 283914408
Test: atest FrameworksNetTests
Change-Id: I0ab04d67bae127628c6d67c4b8c109201612a54b
2023-05-30 17:14:54 +09:00
Paul Hu
7f0af78c5e Pass NsdService thread looper to MdnsDiscoveryManager
MdnsDiscoveryManager should use the same thread that create on
NsdService that is used on other mDns components. Thus, pass that
thread loop to MdnsDiscoveryManager.

Bug: 265787401
Test: atest FrameworksNetTests
Change-Id: Icc23994c3ebc99da6043ed2d93540c44f53a150b
2023-05-16 14:39:09 +08:00
Remi NGUYEN VAN
ce44beb7aa Implement proper subtype advertising
Implement subtype advertising by advertising an additional PTR record if
subtype advertising was requested.

For an advertiser a subtype is just an additional PTR record, so this
just involves plumbing the subtype down to MdnsRecordRepository, which
includes the additional record in the service registration.

Bug: 266167702
Test: atest
Change-Id: I09e780af25149162f16bd75410ddc50f160a0dab
2023-05-12 13:34:27 +09:00
Remi NGUYEN VAN
f2d064112c Implement proper discovery with subtypes
Apps may want to discover a particular subtype, such as
_color._sub._printer._tcp.local, which may return services like
Printer1._printer._tcp.local. The previous code was trying to discover,
and would return service types named _color._sub._printer._tcp.local,
even though the actual service type is still _printer._tcp.local. This
is a regression compared to S/T.

Fix this by passing the subtype to MdnsDiscoveryManager in its options
instead of the service type, and ensure that MdnsDiscoveryManager only
sends callbacks to callers that have requested the given subtype (a
color that asked for _color._sub._printer._tcp.local should not receive
BlackAndWhite._printer._tcp.local).

Bug: 266167702
Test: atest
Change-Id: I21367c66534078667718a9b54dfc858b12ba7103
2023-05-12 13:29:20 +09:00
Remi NGUYEN VAN
2f82fcdd6c Ensure service type ends with a dot in discovery
Historical behavior of onServiceFound is to include a dot at the end of
the service type. To avoid inconsistencies between behavior of new and
older backend, which would be hard to predict/handle for apps, ensure
that the same format is used. This means a dot must be added when using
the new backend.

Implement this by creating the callback service types based on
MdnsServiceInfo obtained from MdnsDiscoveryManager, rather than the
service type that was provided by the calling app. This avoids
inconsistencies as the calling app may or may not include dots
originally, and it may use subtypes ("_sub._type._tcp.local" or even
"_type._tcp.local,_sub"), which would result in callbacks giving invalid
service types, or inconsistent with S/T behavior.

Fixes: 281776253
Test: atest
Change-Id: I677ee885d1ee8e6a09773f21e4dd53e96faee748
2023-05-12 10:35:36 +09:00
Paul Hu
14667deefa Use a single SharedLog for all mdns components
Use a single SharedLog in NsdService, and making subcomponents
for DiscoveryManager/Advertiser/SocketProvider. Because each
logger has 500 maxRecords, so 2000 records in total, which take
too much memory.

Also address leftover comments in previous logging changes.

Before:
  2023-04-17T15:05:27.409895 - [Client10082-1] Register a DiscoveryListener 3 for service type:_nmt274981618._tcp.local
  2023-04-17T15:05:26.408015 - [Client10082-1] New client. useJavaBackend=true

Advertiser:
  2023-04-17T15:05:27.213023 - [testtap0] Probing finished for service 2
  2023-04-17T15:05:26.409607 - Adding service name: ^Nsd.Test|Non-#AsCiI\Characters&\ufffe テスト 測試, type: _nmt274981618._tcp, hostAddresses: , port: 12345, network: null, txtRecord:  with ID 2

DiscoveryManager:
  2023-04-17T15:05:28.227786 - [_nmt274981618._tcp.local-102] onServiceNameDiscovered: ^Nsd.Test|Non-#AsCiI\Characters&\ufffe テスト 測試
  2023-04-17T15:05:27.409104 - createServiceTypeClient for serviceType:_nmt274981618._tcp.local network:102
  2023-04-17T15:05:27.398075 - Registering listener for serviceType: _nmt274981618._tcp.local

SocketProvider:
  2023-04-17T15:05:28.292106 - Remove socket on net:102
  2023-04-17T15:05:26.441517 - Create socket on net:NetworkAsKey{ network=102 }, ifName:testtap0
  2023-04-17T15:05:26.409005 - Start monitoring sockets.

After:
Logs:
  2023-04-17T20:51:42.931769 - [MdnsDiscoveryManager._nmt682015268._tcp.local-101] onServiceNameDiscovered: Name: ^Nsd.Test|Non-#AsCiI\Characters&\ufffe テスト 測試, type: _nmt682015268._tcp.local, subtypes: , ip: [100.70.162.138], ipv6: [fe80::9c0e:d0ff:fe7d:e5aa, 2a00:79e1:abc:6f04:9c0e:d0ff:fe7d:e5aa, 2a00:79e1:abc:6f04:eb56:8e39:5e1f:1102], port: 12345, interfaceIndex: 47, network: 101, textStrings: [], textEntries: []
  2023-04-17T20:51:42.032465 - [NsdService.Client10082-1] Register a DiscoveryListener 3 for service type:_nmt682015268._tcp.local
  2023-04-17T20:51:42.026645 - [MdnsDiscoveryManager] createServiceTypeClient for type:_nmt682015268._tcp.local, net:101
  2023-04-17T20:51:41.091555 - [MdnsAdvertiser] Adding service name: ^Nsd.Test|Non-#AsCiI\Characters&\ufffe テスト 測試, type: _nmt682015268._tcp, hostAddresses: , port: 12345, network: null, txtRecord:  with ID 2
  2023-04-17T20:51:41.091037 - [MdnsSocketProvider] Start monitoring sockets.
  2023-04-17T20:51:41.089951 - [NsdService.Client10082-1] New client. useJavaBackend=true

Bug: 275004614
Test: atest FrameworksNetTests android.net.cts.NsdManagerTest
Change-Id: I1c9b7697cc95748f7fe4e6beecea217d39c56fb1
2023-05-10 02:18:43 +00:00
Treehugger Robot
ab809e5ce0 Merge "Fix isFeatureEnabled namespace and overload usage" 2023-05-08 03:19:27 +00:00
Yuyang Huang
de802c8dc4 Avoid going over max service name length when renaming NSD services
As per  RFC 1034/1035, the max size of the label is 63 bytes. It should
also be guaranteed when the serviceName is renamed due to the conflict.

Bug: 265865456
Test: atest FrameworksNetTests
Change-Id: I077d8abdb91071db62b9618d9918e3a12682aaf4
2023-05-04 13:24:23 +09:00
Motomu Utsumi
278db58bf5 Fix isFeatureEnabled namespace and overload usage
From service-connectivity, NAMESPACE_TETHERING must be used, as
NAMESPACE_CONNECTIVITY is used for the NetworkStack module. Also the
isFeatureEnabled with module name must be used, otherwise the "android"
package version is queried instead of the tethering module version.

BpfNetMaps is using flag value 1 to workaround this issue.
flags in NsdService, AutomaticOnOffKeepaliveTracker, and ConnectivityFlags
were not pushed currently.
So, this change has no effect to devices.

Bug: 279108992
Test: TH
Change-Id: I2b4b6a13c048c20beef52b1f43b9e21aca0c637a
2023-04-28 19:18:43 +09:00
Yuyang Huang
a6a6ff93b2 Refactors common scope id setup code into utility function
Bug: 279691947
Test: atest NetworkStackIntegrationTests NetworkStackRootTests
Test: atest CtsNetTestCases:android.net.cts.NsdManagerTest
Change-Id: I5627037c95b5b9cf4af46018bccffb4f16b402a8
2023-04-27 11:37:50 +09:00
Paul Hu
b2e67d3aca Revert^2 "Put client logs into SharedLog and dump more logs"
b8a3a634a7

Change-Id: I7fe4ef575208d0cddc343112b9478f5898fd714a
2023-04-18 14:52:29 +08:00
Paul Hu
b8a3a634a7 Revert "Put client logs into SharedLog and dump more logs"
Revert submission 2535219

Reason for revert: Build break

Reverted changes: /q/submissionid:2535219

Change-Id: I4bb88b77c77254bb2f806c9e88b91dd304ad24bf
2023-04-18 02:45:34 +00:00
Paul Hu
eaa99274bd Put client logs into SharedLog and dump more logs
- Put client logs into SharedLog and dump them to the bugreport
- Adjust log format in bugreport.
- Also dump DiscoveryManager, Advertiser and SocketProvider logs

Before:
  NsdService:
   total records=9
   rec[0]: time=04-12 14:54:31.742 processed=DefaultState org=EnabledState dest=<null> what=REGISTER_CLIENT
   rec[1]: time=04-12 14:54:31.744 processed=EnabledState org=EnabledState dest=<null> what=REGISTER_SERVICE
   rec[2]: time=04-12 14:54:32.649 processed=EnabledState org=EnabledState dest=<null> what=DISCOVER_SERVICES
  curState=EnabledState

After:
NsdService:
 total records=9
 rec[0]: time=04-17 15:05:26.408 processed=DefaultState org=EnabledState dest=<null> what=REGISTER_CLIENT
 rec[1]: time=04-17 15:05:26.409 processed=EnabledState org=EnabledState dest=<null> what=REGISTER_SERVICE
 rec[2]: time=04-17 15:05:27.409 processed=EnabledState org=EnabledState dest=<null> what=DISCOVER_SERVICES
 rec[3]: time=04-17 15:05:28.236 processed=EnabledState org=EnabledState dest=<null> what=MDNS_DISCOVERY_MANAGER_EVENT
 rec[4]: time=04-17 15:05:28.241 processed=EnabledState org=EnabledState dest=<null> what=RESOLVE_SERVICE
 rec[5]: time=04-17 15:05:28.248 processed=EnabledState org=EnabledState dest=<null> what=MDNS_DISCOVERY_MANAGER_EVENT
 rec[6]: time=04-17 15:05:28.255 processed=EnabledState org=EnabledState dest=<null> what=UNREGISTER_SERVICE
 rec[7]: time=04-17 15:05:28.428 processed=DefaultState org=EnabledState dest=<null> what=UNREGISTER_CLIENT
curState=EnabledState

  2023-04-17T15:05:28.428230 - [Client10082-1] Client unregistered. expungeAllRequests!
  2023-04-17T15:05:28.241837 - [Client10082-1] Register a ResolutionListener 4 for service type:_nmt274981618._tcp.local
  2023-04-17T15:05:27.409895 - [Client10082-1] Register a DiscoveryListener 3 for service type:_nmt274981618._tcp.local
  2023-04-17T15:05:26.408015 - [Client10082-1] New client. useJavaBackend=true

Advertiser:
  2023-04-17T15:05:28.252545 - Removing service with ID 2
  2023-04-17T15:05:27.213023 - [testtap0] Probing finished for service 2
  2023-04-17T15:05:26.409607 - Adding service name: ^Nsd.Test|Non-#AsCiI\Characters&\ufffe テスト 測試, type: _nmt274981618._tcp, hostAddresses: , port: 12345, network: null, txtRecord:  with ID 2

DiscoveryManager:
  2023-04-17T15:05:28.428369 - Unregistering listener for serviceType:_nmt274981618._tcp.local
  2023-04-17T15:05:28.247622 - Unregistering listener for serviceType:_nmt274981618._tcp.local
  2023-04-17T15:05:28.241062 - Registering listener for serviceType: _nmt274981618._tcp.local
  2023-04-17T15:05:28.228777 - [_nmt274981618._tcp.local-102] onServiceFound: ^Nsd.Test|Non-#AsCiI\Characters&\ufffe テスト 測試
  2023-04-17T15:05:28.227786 - [_nmt274981618._tcp.local-102] onServiceNameDiscovered: ^Nsd.Test|Non-#AsCiI\Characters&\ufffe テスト 測試
  2023-04-17T15:05:27.409104 - createServiceTypeClient for serviceType:_nmt274981618._tcp.local network:102
  2023-04-17T15:05:27.398075 - Registering listener for serviceType: _nmt274981618._tcp.local

SocketProvider:
  2023-04-17T15:05:34.377599 - Stop monitoring sockets.
  2023-04-17T15:05:28.292106 - Remove socket on net:102
  2023-04-17T15:05:26.441517 - Create socket on net:NetworkAsKey{ network=102 }, ifName:testtap0
  2023-04-17T15:05:26.409005 - Start monitoring sockets.

Bug: 275004614
Test: atest FrameworksNetTests android.net.cts.NsdManagerTest
Change-Id: I41743f47abe5ca75c2a33da674d24d3a7f997d93
2023-04-17 15:39:45 +08:00
Yuyang Huang
700778be70 Handle downstream tethering interface addresses in MdnsSocketProvider
MdnsSocketProvider currently does not fill addresses of downstream
tethering interfaces in its callbacks. The interface addresses should be
properly updated by listening to the Netlink messages.

Test: atest FrameworksNetTests CtsNetTestCases
Bug: 267980538
Change-Id: I753e547a1b092703fe59c6c9e922ee8aca245f67
2023-04-15 21:55:51 +09:00
Yuyang Huang
3bee9d4099 Avoid creating a Network with INetd.LOCAL_NET_ID
INetd.LOCAL_NET_ID cannot be referred to by system SDK. To make the
MdnsSocketProvider built with system SDK, the reference to
INetd.LOCAL_NET_ID must be removed.

This network is created in MdnsSocketProvider.java and propagated
through MdnsSocketProvider.java -> MdnsMultinetworkSocketClient.java ->
MdnsDiscoveryManager.java -> MdnsServiceTypeClient.java ->
NsdService.java. In NsdService.java, it was used in
handleMdnsDiscoveryManagerEvent() -> buildNsdServiceInfoFromMdnsEvent()
-> setServiceNetworkForCallback(). The setServiceNetworkForCallback() is
updated to handle the NETID_UNSET the same as LOCAL_NET_ID.

Test: atest CtsNetTestCases FrameworksNetTests
Bug: 272392042
Change-Id: I07c573948e9dc6249325f0733807bb7a7ffc281c
2023-04-05 13:06:13 +09:00
Yuyang Huang
aa0e9602bb NsdService should set the Inet6Address scope ids
Link local Inet6Address cannot be used without scope id being set
properly. NsdService should set the Inet6Address scopes everywhere
NsdServiceInfo.setHost or NsdServiceInfo.setHostAddresses is used.

Test: atest CtsNetTestCases:android.net.cts.NsdManagerTest
Bug: 273391977
Change-Id: I45da6aebeba4e2e398e0b58ce3b88470fb60863b
2023-03-30 14:03:31 +09:00
Paul Hu
2e0a88c0fa Add a CompatChange flag to enable platform backend
Apps targeting sdk < U are considered to use a legacy native
daemon as NsdManager backend, but other apps use a
platform-integration mDNS implementation as backend. So add a
CompatChange flag to enable platform backend for non-legacy
apps.

Bug: 270306772
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I7ba58f8a5186fb49ad5f8aeacc8b8234bef1eabe
2023-03-17 09:10:46 +08:00
Remi NGUYEN VAN
d741db3334 Merge changes I53ebf1bb,I8540af27
* changes:
  Enable new NsdManager backend on U+
  Update NsdManagerTest for newer backend usage
2023-03-09 07:11:08 +00:00
Paul Hu
ee0e6cd701 Merge "Migrate reigster service callback backend" 2023-03-08 10:27:57 +00:00
Remi NGUYEN VAN
beb03f141c Enable new NsdManager backend on U+
Instead of using the old mdnsresponder backend, U+ uses
MdnsDiscoveryManager and MdnsAdvertiser.

Bug: 272197605
Test: atest NsdManagerTest
Change-Id: I53ebf1bbba24972e4db87eb4097497329b05caa9
2023-03-08 19:03:27 +09:00
Paul Hu
2b86591d39 Fill in all resolved addresses into NsdServiceInfo
Now, the multiple addresses is supported in resolution service
with the new java backend. Thus, fill in all resolved addresses
into NsdServiceInfo.

Bug: 268586836
Test: atest FrameworksNetTests
Change-Id: I499a749255429df9fe9fbad678074ad383159240
2023-03-06 14:27:53 +08:00
Paul Hu
30bd70d168 Migrate reigster service callback backend
registerServiceInfoCallback currently only sends updates for
addresses added, but does not handle removes (expiration) and
TXT/SRV record updates. Thus, migrate its backend to
MdnsDiscoveryManager which can support the expiration update.

Bug: 266030646
Test: atest FrameworksNetTests CteNetTestCases
Change-Id: I72add213935dc1beacb6277007868ad30bd89c00
2023-03-06 13:49:19 +08:00