Document and enforce "one request per Listener" rule
The API and implementation of NsdManager imply that a separate Listener is to be used for each active registration or discovery request. This isn't formally documented or properly enforced, and weird and unpredictable things happen if an application uses a Listener for more than one request at a time. Update documentation to make this an explicit requirement. Enforce the restriction when a new request is submitted for processing; if the Listener is already being used to track an active request, throw an exception. Document the fact that apps should unregister services and cancel service discoveries when the app is stopped (in KitKat and prior releases, they'll leak if this isn't done.) Re-order "release the Listener" operation to occur before the Listener callback, so that the Listener can be reused by the application once the callback has been entered - this eliminates a race condition. Document this. Pass 2: typos, added documentation about API level, changed to using an explicitly defined return value for "busy listener". Bug: 13512512 Change-Id: Ic164110759204b27d8a14376777b593ebe1865fa
Loading
Please register or sign in to comment