Merge "Add bpf jni into connectivity module" am: 577c46a185
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1888502 Change-Id: Ie66f13e424d113e4d7338a937ca78f9d40b483b5
This commit is contained in:
committed by
Automerger Merge Worker
commit
14e70e1577
@@ -49,7 +49,10 @@ apex {
|
||||
],
|
||||
multilib: {
|
||||
first: {
|
||||
jni_libs: ["libservice-connectivity"],
|
||||
jni_libs: [
|
||||
"libservice-connectivity",
|
||||
"libcom_android_connectivity_com_android_net_module_util_jni"
|
||||
],
|
||||
},
|
||||
both: {
|
||||
jni_libs: ["libframework-connectivity-jni"],
|
||||
|
||||
@@ -19,6 +19,33 @@ package {
|
||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||
}
|
||||
|
||||
// The library name match the service-connectivity jarjar rules that put the JNI utils in the
|
||||
// com.android.connectivity.com.android.net.module.util package.
|
||||
cc_library_shared {
|
||||
name: "libcom_android_connectivity_com_android_net_module_util_jni",
|
||||
min_sdk_version: "30",
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-Wno-unused-parameter",
|
||||
"-Wthread-safety",
|
||||
],
|
||||
srcs: [
|
||||
"jni/com_android_net_module_util/onload.cpp",
|
||||
],
|
||||
stl: "libc++_static",
|
||||
static_libs: [
|
||||
"libnet_utils_device_common_bpfjni",
|
||||
],
|
||||
shared_libs: [
|
||||
"liblog",
|
||||
"libnativehelper",
|
||||
],
|
||||
apex_available: [
|
||||
"com.android.tethering",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "libservice-connectivity",
|
||||
min_sdk_version: "30",
|
||||
@@ -69,6 +96,7 @@ java_library {
|
||||
"modules-utils-build",
|
||||
"modules-utils-shell-command-handler",
|
||||
"net-utils-device-common",
|
||||
"net-utils-device-common-bpf",
|
||||
"net-utils-device-common-netlink",
|
||||
"net-utils-framework-common",
|
||||
"netd-client",
|
||||
|
||||
37
service/jni/com_android_net_module_util/onload.cpp
Normal file
37
service/jni/com_android_net_module_util/onload.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <nativehelper/JNIHelp.h>
|
||||
#include <log/log.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
int register_com_android_net_module_util_BpfMap(JNIEnv* env, char const* class_name);
|
||||
|
||||
extern "C" jint JNI_OnLoad(JavaVM* vm, void*) {
|
||||
JNIEnv *env;
|
||||
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
|
||||
ALOGE("GetEnv failed");
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
if (register_com_android_net_module_util_BpfMap(env,
|
||||
"com/android/connectivity/com/android/net/module/util/BpfMap") < 0) return JNI_ERR;
|
||||
|
||||
return JNI_VERSION_1_6;
|
||||
}
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user