diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 80476ea6d8..12cd5f1721 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -2565,7 +2565,7 @@ public class ConnectivityManager { * replaced by this one, effectively releasing the previous {@link NetworkRequest}. *
* The request may be released normally by calling - * {@link #releaseNetworkRequest(android.app.PendingIntent)}. + * {@link #unregisterNetworkCallback(android.app.PendingIntent)}. *
This method requires the caller to hold the permission * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}. * @param request {@link NetworkRequest} describing this request. @@ -2618,6 +2618,19 @@ public class ConnectivityManager { } catch (RemoteException e) {} } + /** + * Unregisters a callback previously registered via + * {@link #registerNetworkCallback(NetworkRequest, android.app.PendingIntent)}. + * + * @param operation A PendingIntent equal (as defined by {@link Intent#filterEquals}) to the + * PendingIntent passed to + * {@link #registerNetworkCallback(NetworkRequest, android.app.PendingIntent)}. + * Cannot be null. + */ + public void unregisterNetworkCallback(PendingIntent operation) { + releaseNetworkRequest(operation); + } + /** * Informs the system whether it should switch to {@code network} regardless of whether it is * validated or not. If {@code accept} is true, and the network was explicitly selected by the