-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android: Synchronizing on the use of NsdManager.resolveService() #23515
Merged
chrisdecenzo
merged 2 commits into
project-chip:master
from
sharadb-amazon:disc-20221105
Nov 8, 2022
Merged
Android: Synchronizing on the use of NsdManager.resolveService() #23515
chrisdecenzo
merged 2 commits into
project-chip:master
from
sharadb-amazon:disc-20221105
Nov 8, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pullapprove
bot
requested review from
anush-apple,
arkq,
Byungjoo-Lee,
bzbarsky-apple,
carol-apple,
chshu,
chulspro,
Damian-Nordic,
dhrishi,
electrocucaracha,
emargolis,
franck-apple,
gjc13,
harimau-qirex,
harsha-rajendran,
hawk248,
isiu-apple,
jelderton,
jepenven-silabs,
jmartinez-silabs,
jtung-apple,
kpschoedel,
lazarkov,
LuDuda and
mrjerryjohns
November 6, 2022 05:49
pullapprove
bot
requested review from
mspang,
rgoliver,
robszewczyk,
saurabhst,
selissia,
tcarmelveilleux,
tecimovic,
turon,
vijs,
vivien-apple,
wbschiller,
woody-apple,
xylophone21 and
yunhanw-google
November 6, 2022 05:49
PR #23515: Size comparison from 1ee863e to 181a9e4 Increases (3 builds for bl702, qpg, telink)
Decreases (4 builds for bl702, k32w, nrfconnect, telink)
Full report (17 builds for bl702, k32w, linux, mbed, nrfconnect, qpg, telink)
|
chrisdecenzo
approved these changes
Nov 6, 2022
andy31415
reviewed
Nov 7, 2022
src/platform/android/java/chip/platform/NsdManagerServiceResolver.java
Outdated
Show resolved
Hide resolved
src/platform/android/java/chip/platform/NsdManagerServiceResolver.java
Outdated
Show resolved
Hide resolved
src/platform/android/java/chip/platform/NsdManagerServiceResolver.java
Outdated
Show resolved
Hide resolved
PR #23515: Size comparison from 1ee863e to 04ce083 Full report (5 builds for bl702, linux, mbed)
|
andy31415
approved these changes
Nov 8, 2022
sharadb-amazon
added a commit
to sharadb-amazon/connectedhomeip
that referenced
this pull request
Nov 10, 2022
…ject-chip#23515) * Android: Synchronizing on the use of NsdManager.resolveService() * Incorporating comments from andy31415@
sharadb-amazon
added a commit
to sharadb-amazon/connectedhomeip
that referenced
this pull request
Nov 11, 2022
…ject-chip#23515) * Android: Synchronizing on the use of NsdManager.resolveService() * Incorporating comments from andy31415@
adbridge
pushed a commit
to ARM-software/connectedhomeip
that referenced
this pull request
Nov 18, 2022
…ject-chip#23515) * Android: Synchronizing on the use of NsdManager.resolveService() * Incorporating comments from andy31415@
adbridge
pushed a commit
to ARM-software/connectedhomeip
that referenced
this pull request
Nov 18, 2022
…ject-chip#23515) * Android: Synchronizing on the use of NsdManager.resolveService() * Incorporating comments from andy31415@
Excuse? I have a question, wheath it should new NsdManagerResolverAvailState? I havent' found the new NsdManagerResolverAvailState, how can i do ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #23514
Problem
The Android NsdManager seems capable of only resolving one service at a time. If it is called to resolve a service while it already is busy with a previous request, it calls back the second caller's ResolveListener with a FAILURE_ALREADY_ACTIVE error.
This leads to issues with running discovery and resolution from any app code if Matter SDK's NsdManagerServiceResolver.java is running service resolution in parallel. For example, Commissioner discovery/resolution may fail if Operational discovery/resolution is already in progress - as manifested in the Android tv-casting-app bug cited above. Further more, this may lead to issues with any usage of NsdManager's resolveService API for any use case (Matter related or otherwise)
Change summary
This change adds a NsdManagerResolverAvailState to the Matter NsdManagerServiceResolver and allows setting it optionally via an overloaded constructor. If an app provides this NsdManagerResolverAvailState object, it can use it to synchronize with the Matter NsdManagerServiceResolver on the usage of NsdManager's resolveService API. This helps avoid failing with the FAILURE_ALREADY_ACTIVE error when using the NsdManager (in Matter SDK and/or app side code)
Testing
Tested the fix with the android tv-casting-app by following the repro steps in the issue cited above.