summaryrefslogtreecommitdiff
path: root/framework-t/src/android/net/nsd/NsdManager.java
Commit message (Collapse)AuthorAgeFilesLines
* Ensure callbacks are run properly on executorRemi NGUYEN VAN2022-06-031-22/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | NsdManager callbacks were run on a provided executor by capturing the handler message in a lambda, but the message will be recycled immediately after handleMessage returns. This means that any non-inline executor would see bogus callbacks, as they have an empty Message. Fix it by not capturing the Message in the lambda, but capturing its contents instead. This was broken when updating the class to support executors in change ID: I4c31e2d7ae601ea808b1fd64df32d116c6fff97f; before that, callbacks were all run on the NsdManager handler. Also, DelegatingDiscoveryListener is being run on the NsdManager handler thread for notifyAllServicesLost, causing onServiceLost to be run there, but other methods are run on the provided Executor, even though they access maps maintained on the handler thread, like mPerNetworkListeners. Revert DelegatingDiscoveryListener to run on the handler thread as before, and only use the provided executor to execute any app-facing callback instead. Bug: 234419509 Test: atest NsdManagerTest Change-Id: Icca64511b02dad2f725a2849d2a1e871135b3286 (cherry picked from commit 9133888e0c25208f7907cf4353bd4eaedc8ef9cd) Merged-In: Icca64511b02dad2f725a2849d2a1e871135b3286
* Use MDns aidl on NsdServicepaulhu2022-04-041-2/+2
| | | | | | | | | | | - Use MDns aidl to communicate with mdns service and register event listener to receive callback. - Remove all NDC relevant code on NsdService. - Use MDns aidl on NsdServiceTest. Bug: 209894875 Test: atest FrameworksNetTests CtsNetTestCases Change-Id: I65929dee3838fef753396e86c665abd66b6fec81
* Add Executors to NSD callbacksRemi NGUYEN VAN2022-03-181-33/+111
| | | | | | | | Add Executor variants to all methods with callbacks. Bug: 218752665 Test: atest NsdManagerTest Change-Id: I4c31e2d7ae601ea808b1fd64df32d116c6fff97f
* Support discovering services with a NetworkRequestRemi NGUYEN VAN2022-02-031-1/+248
| | | | | | | | | | | | | | A common mistake when using service discovery is to mismanage networks, expecting to find or be able to access services on networks that may not be available yet, or may be stale/lost. This new API allows clients to start service discovery with just a NetworkRequest, letting NsdManager track networks and notify when services are found/lost for each network. Bug: 190249673 Test: atest NsdManagerTest Change-Id: I12e799aa48fce2d1a35f708c5617386b1cc70f21
* Support discover/resolve on specific networksRemi NGUYEN VAN2022-02-031-1/+15
| | | | | | | | | | | | | | | | | This adds a Network member to NsdServiceInfo, allowing discovered services to report which network they were discovered on, and clients to specify which network to resolve the service on. If clients use the discovered NsdServiceInfo to resolve a service, it will be resolved on the network where it was discovered instead of an unspecified network. Also add a network parameter to a new overload of NsdManager#discoverServices, so that clients can discover on specific networks. Bug: 190249673 Test: atest NsdManagerTest Change-Id: Idc4bf9fde0f4b0328204a8cd2eedc12fffbbbdba
* Remove Preconditions, Protocol @hide usageRemi NGUYEN VAN2021-12-131-40/+50
| | | | | | | | | | | | | Remove hidden API usage of the Preconditions and Protocol classes in NsdManager. NsdManager does not share its handler with other components, so it does not need to use specific message IDs from Protocol. Preconditions can also be easily replaced with stable API alternatives. Bug: 190249673 Test: atest FrameworksNetTests CtsNetTestCases:NsdManagerTest Change-Id: Ia173f99b82c90df702291c3690f4a7b047e90daa
* Move f/b/packages/Nsd files to f/b/packages/ConnectivityTAaron Huang2021-12-091-0/+734
Move Nsd files to ConnectivityT so that nsd, ipsec, ethernet and netstats files can live in the same directory and it will be easier to move everything in frameworks/base/packages/ConnectivityT to packages/modules/Connectivity after fixing all of the hidden API usages. Bug: 204153604 Test: FrameworksNetTests CtsNetTestCases Change-Id: I411e242e8739d15920cfc2fe274115f7f39bd89f