diff options
author | Robert Greenwalt <robdroid@android.com> | 2010-08-27 09:24:29 -0700 |
---|---|---|
committer | Robert Greenwalt <rgreenwalt@google.com> | 2010-08-27 11:05:11 -0700 |
commit | 585ac0fc8dde3fe35ec4c71c8f215f2c84139b8b (patch) | |
tree | 257ca7032592dbd69e2d213bc8cca1ace651c8ac /core/java/android/net/ConnectivityManager.java | |
parent | e73d10c6fb9013ee8e26f337384d4924f6db8a21 (diff) | |
download | frameworks_base-585ac0fc8dde3fe35ec4c71c8f215f2c84139b8b.zip frameworks_base-585ac0fc8dde3fe35ec4c71c8f215f2c84139b8b.tar.gz frameworks_base-585ac0fc8dde3fe35ec4c71c8f215f2c84139b8b.tar.bz2 |
resolved conflicts for merge of 4ea54f44 to master
Change-Id: Ia77bb59a6e1950648c8ebf7db307e204f93a9f56
Diffstat (limited to 'core/java/android/net/ConnectivityManager.java')
-rw-r--r-- | core/java/android/net/ConnectivityManager.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 8d1a04c..05ebd07 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -21,6 +21,9 @@ import android.annotation.SdkConstant.SdkConstantType; import android.os.Binder; import android.os.RemoteException; +import java.net.InetAddress; +import java.net.UnknownHostException; + /** * Class that answers queries about the state of network connectivity. It also * notifies applications when network connectivity changes. Get an instance @@ -309,8 +312,29 @@ public class ConnectivityManager * @return {@code true} on success, {@code false} on failure */ public boolean requestRouteToHost(int networkType, int hostAddress) { + InetAddress inetAddress = NetworkUtils.intToInetAddress(hostAddress); + + if (inetAddress == null) { + return false; + } + + return requestRouteToHostAddress(networkType, inetAddress); + } + + /** + * Ensure that a network route exists to deliver traffic to the specified + * host via the specified network interface. An attempt to add a route that + * already exists is ignored, but treated as successful. + * @param networkType the type of the network over which traffic to the specified + * host is to be routed + * @param hostAddress the IP address of the host to which the route is desired + * @return {@code true} on success, {@code false} on failure + * @hide + */ + public boolean requestRouteToHostAddress(int networkType, InetAddress hostAddress) { + byte[] address = hostAddress.getAddress(); try { - return mService.requestRouteToHost(networkType, hostAddress); + return mService.requestRouteToHostAddress(networkType, address); } catch (RemoteException e) { return false; } |