diff options
| -rw-r--r-- | api/current.txt | 4 | ||||
| -rw-r--r-- | api/system-current.txt | 4 | ||||
| -rw-r--r-- | api/test-current.txt | 4 | ||||
| -rw-r--r-- | core/java/android/net/ConnectivityManager.java | 62 |
4 files changed, 15 insertions, 59 deletions
diff --git a/api/current.txt b/api/current.txt index 68a6bc563c34..ab15269b62a4 100644 --- a/api/current.txt +++ b/api/current.txt @@ -25396,8 +25396,8 @@ package android.net { method public boolean requestBandwidthUpdate(android.net.Network); method public void requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback); method public void requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback, android.os.Handler); - method public void requestNetwork(android.net.NetworkRequest, int, android.net.ConnectivityManager.NetworkCallback); - method public void requestNetwork(android.net.NetworkRequest, int, android.net.ConnectivityManager.NetworkCallback, android.os.Handler); + method public void requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback, int); + method public void requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback, android.os.Handler, int); method public void requestNetwork(android.net.NetworkRequest, android.app.PendingIntent); method public deprecated void setNetworkPreference(int); method public static deprecated boolean setProcessDefaultNetwork(android.net.Network); diff --git a/api/system-current.txt b/api/system-current.txt index 76e4fc593fbe..2d74bc48411c 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -27577,8 +27577,8 @@ package android.net { method public boolean requestBandwidthUpdate(android.net.Network); method public void requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback); method public void requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback, android.os.Handler); - method public void requestNetwork(android.net.NetworkRequest, int, android.net.ConnectivityManager.NetworkCallback); - method public void requestNetwork(android.net.NetworkRequest, int, android.net.ConnectivityManager.NetworkCallback, android.os.Handler); + method public void requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback, int); + method public void requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback, android.os.Handler, int); method public void requestNetwork(android.net.NetworkRequest, android.app.PendingIntent); method public deprecated void setNetworkPreference(int); method public static deprecated boolean setProcessDefaultNetwork(android.net.Network); diff --git a/api/test-current.txt b/api/test-current.txt index 3305ba928db2..9cdf34a43043 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -25504,8 +25504,8 @@ package android.net { method public boolean requestBandwidthUpdate(android.net.Network); method public void requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback); method public void requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback, android.os.Handler); - method public void requestNetwork(android.net.NetworkRequest, int, android.net.ConnectivityManager.NetworkCallback); - method public void requestNetwork(android.net.NetworkRequest, int, android.net.ConnectivityManager.NetworkCallback, android.os.Handler); + method public void requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback, int); + method public void requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback, android.os.Handler, int); method public void requestNetwork(android.net.NetworkRequest, android.app.PendingIntent); method public deprecated void setNetworkPreference(int); method public static deprecated boolean setProcessDefaultNetwork(android.net.Network); diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index b854cbf2d0f8..2f2e79af57d4 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -2974,11 +2974,6 @@ public class ConnectivityManager { } /** - * Note: this is a deprecated version of - * {@link #requestNetwork(NetworkRequest, int, NetworkCallback)} - please transition code to use - * the unhidden version of the function. - * TODO: replace all callers with the new version of the API - * * Request a network to satisfy a set of {@link android.net.NetworkCapabilities}, limited * by a timeout. * @@ -2991,7 +2986,7 @@ public class ConnectivityManager { * request that timed out is not an error. * * <p>Do not use this method to poll for the existence of specific networks (e.g. with a small - * timeout) - the {@link #registerNetworkCallback(NetworkRequest, NetworkCallback)} is provided + * timeout) - {@link #registerNetworkCallback(NetworkRequest, NetworkCallback)} is provided * for that purpose. Calling this method will attempt to bring up the requested network. * * <p>This method requires the caller to hold either the @@ -3000,13 +2995,11 @@ public class ConnectivityManager { * {@link android.provider.Settings.System#canWrite}.</p> * * @param request {@link NetworkRequest} describing this request. - * @param networkCallback The callbacks to be utilized for this request. Note - * the callbacks must not be shared - they uniquely specify - * this request. + * @param networkCallback The {@link NetworkCallback} to be utilized for this request. Note + * the callback must not be shared - it uniquely specifies this request. * @param timeoutMs The time in milliseconds to attempt looking for a suitable network * before {@link NetworkCallback#onUnavailable()} is called. The timeout must * be a positive value (i.e. >0). - * @hide */ public void requestNetwork(NetworkRequest request, NetworkCallback networkCallback, int timeoutMs) { @@ -3017,43 +3010,6 @@ public class ConnectivityManager { requestNetwork(request, networkCallback, timeoutMs, legacyType, getDefaultHandler()); } - /** - * Request a network to satisfy a set of {@link android.net.NetworkCapabilities}, limited - * by a timeout. - * - * This function behaves identically to the non-timed-out version - * {@link #requestNetwork(NetworkRequest, NetworkCallback)}, but if a suitable network - * is not found within the given time (in milliseconds) the - * {@link NetworkCallback#onUnavailable()} callback is called. The request can still be - * released normally by calling {@link #unregisterNetworkCallback(NetworkCallback)} but does - * not have to be released if timed-out (it is automatically released). Unregistering a - * request that timed out is not an error. - * - * <p>Do not use this method to poll for the existence of specific networks (e.g. with a small - * timeout) - {@link #registerNetworkCallback(NetworkRequest, NetworkCallback)} is provided - * for that purpose. Calling this method will attempt to bring up the requested network. - * - * <p>This method requires the caller to hold either the - * {@link android.Manifest.permission#CHANGE_NETWORK_STATE} permission - * or the ability to modify system settings as determined by - * {@link android.provider.Settings.System#canWrite}.</p> - * - * @param request {@link NetworkRequest} describing this request. - * @param timeoutMs The time in milliseconds to attempt looking for a suitable network - * before {@link NetworkCallback#onUnavailable()} is called. The timeout must - * be a positive value (i.e. >0). - * @param networkCallback The {@link NetworkCallback} to be utilized for this request. Note - * the callback must not be shared - it uniquely specifies this request. - */ - public void requestNetwork(NetworkRequest request, int timeoutMs, - NetworkCallback networkCallback) { - if (timeoutMs <= 0) { - throw new IllegalArgumentException("Non-positive timeoutMs: " + timeoutMs); - } - int legacyType = inferLegacyTypeForNetworkCapabilities(request.networkCapabilities); - requestNetwork(request, networkCallback, timeoutMs, legacyType, getDefaultHandler()); - } - /** * Request a network to satisfy a set of {@link android.net.NetworkCapabilities}, limited @@ -3076,14 +3032,14 @@ public class ConnectivityManager { * {@link android.provider.Settings.System#canWrite}.</p> * * @param request {@link NetworkRequest} describing this request. - * @param timeoutMs The time in milliseconds to attempt looking for a suitable network - * before {@link NetworkCallback#onUnavailable} is called. * @param networkCallback The {@link NetworkCallback} to be utilized for this request. Note * the callback must not be shared - it uniquely specifies this request. * @param handler {@link Handler} to specify the thread upon which the callback will be invoked. + * @param timeoutMs The time in milliseconds to attempt looking for a suitable network + * before {@link NetworkCallback#onUnavailable} is called. */ - public void requestNetwork(NetworkRequest request, int timeoutMs, - NetworkCallback networkCallback, Handler handler) { + public void requestNetwork(NetworkRequest request, NetworkCallback networkCallback, + Handler handler, int timeoutMs) { if (timeoutMs <= 0) { throw new IllegalArgumentException("Non-positive timeoutMs"); } @@ -3402,8 +3358,8 @@ public class ConnectivityManager { /** * It is acceptable to briefly use multipath data to provide seamless connectivity for * time-sensitive user-facing operations when the system default network is temporarily - * unresponsive. The amount of data should be limited (less than one megabyte), and the - * operation should be infrequent to ensure that data usage is limited. + * unresponsive. The amount of data should be limited (less than one megabyte for every call to + * this method), and the operation should be infrequent to ensure that data usage is limited. * * An example of such an operation might be a time-sensitive foreground activity, such as a * voice command, that the user is performing while walking out of range of a Wi-Fi network. |