diff options
| author | 2015-11-25 12:00:52 +0900 | |
|---|---|---|
| committer | 2015-11-25 12:00:52 +0900 | |
| commit | 7de289f355f40f82b65f9c138df695f575191ef9 (patch) | |
| tree | b68a11fbaf55fe96cc61b2be2f95f4678190bb94 | |
| parent | 831204c651b43631d6dc1d7168863eb7cfa71683 (diff) | |
Temporarily add a requestNetwork flavour that takes a legacy type
This method is public @hide to support progressive refactoring of
tethering away from startUsingNetworkFeature to requestNetwork,
without getting in the way of the CONNECTIVITY_ACTION cleanup in
b/22513439 .
Bug: 9580643
Bug: 22513439
Change-Id: I9053ec746cc8f415a2d5849f044667eeb14e1b19
| -rw-r--r-- | core/java/android/net/ConnectivityManager.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index ad9058f35dad..a5f712e4a96d 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -2484,6 +2484,22 @@ public class ConnectivityManager { } /** + * Helper function to requests a network with a particular legacy type. + * + * This is temporarily public @hide so it can be called by system code that uses the + * NetworkRequest API to request networks but relies on CONNECTIVITY_ACTION broadcasts for + * instead network notifications. + * + * TODO: update said system code to rely on NetworkCallbacks and make this method private. + * + * @hide + */ + public void requestNetwork(NetworkCapabilities nc, NetworkCallback networkCallback, + int timeoutMs, int legacyType) { + sendRequestForNetwork(nc, networkCallback, timeoutMs, REQUEST, legacyType); + } + + /** * Request a network to satisfy a set of {@link android.net.NetworkCapabilities}. * * This {@link NetworkRequest} will live until released via @@ -2513,8 +2529,8 @@ public class ConnectivityManager { * {@code NetworkCapabilities}. */ public void requestNetwork(NetworkRequest request, NetworkCallback networkCallback) { - sendRequestForNetwork(request.networkCapabilities, networkCallback, 0, - REQUEST, inferLegacyTypeForNetworkCapabilities(request.networkCapabilities)); + requestNetwork(request.networkCapabilities, networkCallback, 0, + inferLegacyTypeForNetworkCapabilities(request.networkCapabilities)); } /** @@ -2537,12 +2553,15 @@ public class ConnectivityManager { * this request. * @param timeoutMs The time in milliseconds to attempt looking for a suitable network * before {@link NetworkCallback#unavailable} is called. + * + * TODO: Make timeouts work and then unhide this method. + * * @hide */ public void requestNetwork(NetworkRequest request, NetworkCallback networkCallback, int timeoutMs) { - sendRequestForNetwork(request.networkCapabilities, networkCallback, timeoutMs, - REQUEST, inferLegacyTypeForNetworkCapabilities(request.networkCapabilities)); + requestNetwork(request.networkCapabilities, networkCallback, timeoutMs, + inferLegacyTypeForNetworkCapabilities(request.networkCapabilities)); } /** |