diff options
3 files changed, 46 insertions, 43 deletions
diff --git a/packages/Connectivity/framework/src/android/net/ConnectivityManager.java b/packages/Connectivity/framework/src/android/net/ConnectivityManager.java index a73d76e5b147..c8bc662364da 100644 --- a/packages/Connectivity/framework/src/android/net/ConnectivityManager.java +++ b/packages/Connectivity/framework/src/android/net/ConnectivityManager.java @@ -3326,9 +3326,10 @@ public class ConnectivityManager { * Register or update a network offer with ConnectivityService. * * ConnectivityService keeps track of offers made by the various providers and matches - * them to networking requests made by apps or the system. The provider supplies a score - * and the capabilities of the network it might be able to bring up ; these act as filters - * used by ConnectivityService to only send those requests that can be fulfilled by the + * them to networking requests made by apps or the system. A callback identifies an offer + * uniquely, and later calls with the same callback update the offer. The provider supplies a + * score and the capabilities of the network it might be able to bring up ; these act as + * filters used by ConnectivityService to only send those requests that can be fulfilled by the * provider. * * The provider is under no obligation to be able to bring up the network it offers at any diff --git a/packages/Connectivity/framework/src/android/net/INetworkOfferCallback.aidl b/packages/Connectivity/framework/src/android/net/INetworkOfferCallback.aidl index 67d2d405dbed..a6de173fa33e 100644 --- a/packages/Connectivity/framework/src/android/net/INetworkOfferCallback.aidl +++ b/packages/Connectivity/framework/src/android/net/INetworkOfferCallback.aidl @@ -22,15 +22,16 @@ import android.net.NetworkRequest; * A callback registered with connectivity by network providers together with * a NetworkOffer. * - * When the offer is needed to satisfy some application or system component, - * connectivity will call onOfferNeeded on this callback. When this happens, - * the provider should try and bring up the network. + * When the network for this offer is needed to satisfy some application or + * system component, connectivity will call onNetworkNeeded on this callback. + * When this happens, the provider should try and bring up the network. * - * When the offer is no longer needed, for example because the application has - * withdrawn the request or if the request is being satisfied by a network - * that this offer will never be able to beat, connectivity calls - * onOfferUnneeded. When this happens, the provider should stop trying to - * bring up the network, or tear it down if it has already been brought up. + * When the network for this offer is no longer needed, for example because + * the application has withdrawn the request or if the request is being + * satisfied by a network that this offer will never be able to beat, + * connectivity calls onNetworkUnneeded. When this happens, the provider + * should stop trying to bring up the network, or tear it down if it has + * already been brought up. * * When NetworkProvider#offerNetwork is called, the provider can expect to * immediately receive all requests that can be fulfilled by that offer and @@ -38,25 +39,25 @@ import android.net.NetworkRequest; * request is currently outstanding, because no requests have been made that * can be satisfied by this offer, or because all such requests are already * satisfied by a better network. - * onOfferNeeded can be called at any time after registration and until the + * onNetworkNeeded can be called at any time after registration and until the * offer is withdrawn with NetworkProvider#unofferNetwork is called. This * typically happens when a new network request is filed by an application, * or when the network satisfying a request disconnects and this offer now - * stands a chance to be the best network for it. + * stands a chance to supply the best network for it. * * @hide */ oneway interface INetworkOfferCallback { /** - * Informs the registrant that the offer is needed to fulfill this request. + * Called when a network for this offer is needed to fulfill this request. * @param networkRequest the request to satisfy * @param providerId the ID of the provider currently satisfying * this request, or NetworkProvider.ID_NONE if none. */ - void onOfferNeeded(in NetworkRequest networkRequest, int providerId); + void onNetworkNeeded(in NetworkRequest networkRequest, int providerId); /** - * Informs the registrant that the offer is no longer needed to fulfill this request. + * Informs the registrant that the offer is no longer valuable to fulfill this request. */ - void onOfferUnneeded(in NetworkRequest networkRequest); + void onNetworkUnneeded(in NetworkRequest networkRequest); } diff --git a/packages/Connectivity/framework/src/android/net/NetworkProvider.java b/packages/Connectivity/framework/src/android/net/NetworkProvider.java index d5b5c9b603ec..d859022552c1 100644 --- a/packages/Connectivity/framework/src/android/net/NetworkProvider.java +++ b/packages/Connectivity/framework/src/android/net/NetworkProvider.java @@ -170,10 +170,11 @@ public class NetworkProvider { /** @hide */ // TODO : make @SystemApi when the impl is complete public interface NetworkOfferCallback { - /** Called by the system when this offer is needed to satisfy some networking request. */ - void onOfferNeeded(@NonNull NetworkRequest request, int providerId); - /** Called by the system when this offer is no longer needed. */ - void onOfferUnneeded(@NonNull NetworkRequest request); + /** Called by the system when a network for this offer is needed to satisfy some + * networking request. */ + void onNetworkNeeded(@NonNull NetworkRequest request, int providerId); + /** Called by the system when this offer is no longer valuable for this request. */ + void onNetworkUnneeded(@NonNull NetworkRequest request); } private class NetworkOfferCallbackProxy extends INetworkOfferCallback.Stub { @@ -187,14 +188,14 @@ public class NetworkProvider { } @Override - public void onOfferNeeded(final @NonNull NetworkRequest request, + public void onNetworkNeeded(final @NonNull NetworkRequest request, final int providerId) { - mExecutor.execute(() -> callback.onOfferNeeded(request, providerId)); + mExecutor.execute(() -> callback.onNetworkNeeded(request, providerId)); } @Override - public void onOfferUnneeded(final @NonNull NetworkRequest request) { - mExecutor.execute(() -> callback.onOfferUnneeded(request)); + public void onNetworkUnneeded(final @NonNull NetworkRequest request) { + mExecutor.execute(() -> callback.onNetworkUnneeded(request)); } } @@ -213,41 +214,41 @@ public class NetworkProvider { } /** - * Register or update an offer for network with the passed caps and score. + * Register or update an offer for network with the passed capabilities and score. * - * A NetworkProvider's job is to provide networks. This function is how a provider tells the + * A NetworkProvider's role is to provide networks. This method is how a provider tells the * connectivity stack what kind of network it may provide. The score and caps arguments act - * as filters that the connectivity stack uses to tell when the offer is necessary. When an - * offer might be advantageous over existing networks, the provider will receive a call to - * the associated callback's {@link NetworkOfferCallback#onOfferNeeded} method. The provider - * should then try to bring up this network. When an offer is no longer needed, the stack - * will inform the provider by calling {@link NetworkOfferCallback#onOfferUnneeded}. The + * as filters that the connectivity stack uses to tell when the offer is valuable. When an + * offer might be preferred over existing networks, the provider will receive a call to + * the associated callback's {@link NetworkOfferCallback#onNetworkNeeded} method. The provider + * should then try to bring up this network. When an offer is no longer useful, the stack + * will inform the provider by calling {@link NetworkOfferCallback#onNetworkUnneeded}. The * provider should stop trying to bring up such a network, or disconnect it if it already has * one. * - * The stack determines what offers are needed according to what networks are currently + * The stack determines what offers are valuable according to what networks are currently * available to the system, and what networking requests are made by applications. If an - * offer looks like it could be a better choice than any existing network for any particular - * request, that's when the stack decides the offer is needed. If the current networking - * requests are all satisfied by networks that this offer can't possibly be a better match - * for, that's when the offer is unneeded. An offer starts off as unneeded ; the provider - * should not try to bring up the network until {@link NetworkOfferCallback#onOfferNeeded} - * is called. + * offer looks like it could connect a better network than any existing network for any + * particular request, that's when the stack decides the network is needed. If the current + * networking requests are all satisfied by networks that this offer couldn't possibly be a + * better match for, that's when the offer is no longer valuable. An offer starts out as + * unneeded ; the provider should not try to bring up the network until + * {@link NetworkOfferCallback#onNetworkNeeded} is called. * * Note that the offers are non-binding to the providers, in particular because providers * often don't know if they will be able to bring up such a network at any given time. For - * example, no wireless network may be in range when the offer is needed. This is fine and - * expected ; the provider should simply continue to try to bring up the network and do so + * example, no wireless network may be in range when the offer would be valuable. This is fine + * and expected ; the provider should simply continue to try to bring up the network and do so * if/when it becomes possible. In the mean time, the stack will continue to satisfy requests * with the best network currently available, or if none, keep the apps informed that no * network can currently satisfy this request. When/if the provider can bring up the network, * the connectivity stack will match it against requests, and inform interested apps of the * availability of this network. This may, in turn, render the offer of some other provider - * unneeded if all requests it used to satisfy are now better served by this network. + * low-value if all requests it used to satisfy are now better served by this network. * * A network can become unneeded for a reason like the above : whether the provider managed * to bring up the offered network after it became needed or not, some other provider may - * bring up a better network than this one, making this offer unneeded. A network may also + * bring up a better network than this one, making this network unneeded. A network may also * become unneeded if the application making the request withdrew it (for example, after it * is done transferring data, or if the user canceled an operation). * |