NetworkProvider: Do not propagate callbacks for unregistered offers
Previously, after calling unregisterNetworkOffer(), onNetworkNeeded() / onNetworkUnneeded callbacks are still being called until CS's handler thread has finished running. While this behavior could be taken care of in the network provider implemention (e.g. the ethernet service), it is much simpler to deal with in NetworkProvider.java. As NetworkProvider.java wraps the passed callback object inside a proxy that it forwards to CS, it should be as simple as adding a boolean to the proxy that is checked inside the executor thread before the implementation's callback is called. Since for every call to registerNetworkOffer() with a new callback object a new proxy object is created, this should be safe. Even if the callback object is reused on the user side (such as ethernet service does right now), this should be okay, as the implementation will only receive callbacks from the active proxy. Test: atest NetworkProviderTest Bug: 171872016 Change-Id: Iaf84b5801ad3ee44895e933763927151ea5824dd
Loading
Please register or sign in to comment