Skip to content
Snippets Groups Projects
Commit 02f6124b authored by Yan Yan's avatar Yan Yan
Browse files

Check whether kernel is for X86 via JNI

Bug: 319532485
Test: Verified the return value on husky (arm)
      and cuttlefish (x86_64)
Change-Id: I8fd53b0f137ad701e051644eafaa12c2a5cf3e7f
parent 8ceb02c5
No related branches found
No related tags found
No related merge requests found
......@@ -255,6 +255,10 @@ static jboolean android_net_utils_isKernel64Bit(JNIEnv *env, jclass clazz) {
return bpf::isKernel64Bit();
}
static jboolean android_net_utils_isKernelX86(JNIEnv *env, jclass clazz) {
return bpf::isX86();
}
// ----------------------------------------------------------------------------
/*
......@@ -278,6 +282,7 @@ static const JNINativeMethod gNetworkUtilMethods[] = {
{ "setsockoptBytes", "(Ljava/io/FileDescriptor;II[B)V",
(void*) android_net_utils_setsockoptBytes},
{ "isKernel64Bit", "()Z", (void*) android_net_utils_isKernel64Bit },
{ "isKernelX86", "()Z", (void*) android_net_utils_isKernelX86 },
};
// clang-format on
......
......@@ -440,4 +440,7 @@ public class NetworkUtils {
/** Returns whether the Linux Kernel is 64 bit */
public static native boolean isKernel64Bit();
/** Returns whether the Linux Kernel is x86 */
public static native boolean isKernelX86();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment