Use libnetjniutils for JNI File Descriptor info
Drops use of deprecated API in libnativehelper and uses a common
helper that will be stable across releases.
Bug: 158749603
Test: m
Change-Id: Ic1a1811ffb9a1c207f562a180417e99df31e3502
diff --git a/Tethering/jni/android_net_util_TetheringUtils.cpp b/Tethering/jni/android_net_util_TetheringUtils.cpp
index 94c871d..7bfb6da 100644
--- a/Tethering/jni/android_net_util_TetheringUtils.cpp
+++ b/Tethering/jni/android_net_util_TetheringUtils.cpp
@@ -19,8 +19,8 @@
#include <jni.h>
#include <linux/filter.h>
#include <nativehelper/JNIHelp.h>
-#include <nativehelper/JNIHelpCompat.h>
#include <nativehelper/ScopedUtfChars.h>
+#include <netjniutils/netjniutils.h>
#include <net/if.h>
#include <netinet/ether.h>
#include <netinet/ip6.h>
@@ -57,7 +57,7 @@
filter_code,
};
- int fd = jniGetFDFromFileDescriptor(env, javaFd);
+ int fd = netjniutils::GetNativeFileDescriptor(env, javaFd);
if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)) != 0) {
jniThrowExceptionFmt(env, "java/net/SocketException",
"setsockopt(SO_ATTACH_FILTER): %s", strerror(errno));
@@ -79,7 +79,7 @@
{
static const int kLinkLocalHopLimit = 255;
- int fd = jniGetFDFromFileDescriptor(env, javaFd);
+ int fd = netjniutils::GetNativeFileDescriptor(env, javaFd);
// Set an ICMPv6 filter that only passes Router Solicitations.
struct icmp6_filter rs_only;