summaryrefslogtreecommitdiff
path: root/tests/common/java/android/net/LinkPropertiesTest.java
diff options
context:
space:
mode:
authorRemi NGUYEN VAN <reminv@google.com>2022-05-31 18:39:18 +0900
committerCherrypicker Worker <android-build-cherrypicker-worker@google.com>2022-06-03 09:07:40 +0000
commit905273c7dcad87dee000ffecba7c71f5ddaee2cb (patch)
treef96a0fb396e93eee99104c4157d2e8df00cccca8 /tests/common/java/android/net/LinkPropertiesTest.java
parenta2f1cf3576a7f0329cf0f8aed5bd150230f62122 (diff)
Ensure callbacks are run properly on executor
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
Diffstat (limited to 'tests/common/java/android/net/LinkPropertiesTest.java')
0 files changed, 0 insertions, 0 deletions