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
This commit is contained in:
parent
8ceb02c541
commit
02f6124b05
2 changed files with 8 additions and 0 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue