diff options
| author | Chiachang Wang <chiachangwang@google.com> | 2021-01-27 02:44:29 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-01-27 02:44:29 +0000 |
| commit | 1bd8cd59a5c19365f73a2ffb9713f47c3b72207c (patch) | |
| tree | b64242aaa36f387697fab5bd04005790cb790c80 /core/java/android | |
| parent | f0aa57318d9b93689d2644a62c742f159cd46dd7 (diff) | |
| parent | db2cec60243aebd800d3eb44cc674f636ac02ffd (diff) | |
Merge "Update jni to get int descriptor in native layer"
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/net/Network.java | 2 | ||||
| -rw-r--r-- | core/java/android/net/NetworkUtils.java | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/core/java/android/net/Network.java b/core/java/android/net/Network.java index f98a1f8a220d..fbca7f178e3c 100644 --- a/core/java/android/net/Network.java +++ b/core/java/android/net/Network.java @@ -420,7 +420,7 @@ public class Network implements Parcelable { throw new SocketException("Only AF_INET/AF_INET6 sockets supported"); } - final int err = NetworkUtils.bindSocketToNetwork(fd.getInt$(), netId); + final int err = NetworkUtils.bindSocketToNetwork(fd, netId); if (err != 0) { // bindSocketToNetwork returns negative errno. throw new ErrnoException("Binding socket to network " + netId, -err) diff --git a/core/java/android/net/NetworkUtils.java b/core/java/android/net/NetworkUtils.java index b5962c5bae14..8be4af7b1396 100644 --- a/core/java/android/net/NetworkUtils.java +++ b/core/java/android/net/NetworkUtils.java @@ -81,11 +81,11 @@ public class NetworkUtils { public native static boolean bindProcessToNetworkForHostResolution(int netId); /** - * Explicitly binds {@code socketfd} to the network designated by {@code netId}. This + * Explicitly binds {@code fd} to the network designated by {@code netId}. This * overrides any binding via {@link #bindProcessToNetwork}. * @return 0 on success or negative errno on failure. */ - public native static int bindSocketToNetwork(int socketfd, int netId); + public static native int bindSocketToNetwork(FileDescriptor fd, int netId); /** * Protect {@code fd} from VPN connections. After protecting, data sent through @@ -93,9 +93,7 @@ public class NetworkUtils { * forwarded through the VPN. */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - public static boolean protectFromVpn(FileDescriptor fd) { - return protectFromVpn(fd.getInt$()); - } + public static native boolean protectFromVpn(FileDescriptor fd); /** * Protect {@code socketfd} from VPN connections. After protecting, data sent through |
