From 169f6622034b2c09f842327893b76d9bf89ad1df Mon Sep 17 00:00:00 2001 From: Paul Jensen Date: Tue, 30 Jun 2015 14:29:18 -0400 Subject: [PATCH] Add ConnectivityManager.unregisterNetworkCallback(PendingIntent) API This better pairs up with registerNetworkCallback(NetworkRequest, PendingIntent). Bug:22175708 Change-Id: I336df3f48a0b814f1cbeba6d00afc4e6cc536483 --- core/java/android/net/ConnectivityManager.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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