Add JNI stats libraries to connectivity
Add new symbols to libservice-connectivity loaded on T only, and the framework libraries to apex and tests. Bug: 197717846 Test: atest FrameworksNetTests (cherry-picked and splitting apex Android.bp to aosp/1994130) Change-Id: Iae44344701a3267110e5cbf271120201134d59e5 Merged-In: Iae44344701a3267110e5cbf271120201134d59e5
This commit is contained in:
committed by
Junyu Lai
parent
e764686003
commit
d95048929c
@@ -41,7 +41,6 @@ cc_library {
|
||||
cfi: true,
|
||||
},
|
||||
apex_available: [
|
||||
"//apex_available:platform",
|
||||
"com.android.tethering",
|
||||
],
|
||||
min_sdk_version: "30",
|
||||
|
||||
@@ -55,6 +55,7 @@ cc_library_shared {
|
||||
"-Wthread-safety",
|
||||
],
|
||||
srcs: [
|
||||
":services.connectivity-netstats-jni-sources",
|
||||
"jni/com_android_server_BpfNetMaps.cpp",
|
||||
"jni/com_android_server_connectivity_ClatCoordinator.cpp",
|
||||
"jni/com_android_server_TestNetworkService.cpp",
|
||||
@@ -66,15 +67,19 @@ cc_library_shared {
|
||||
static_libs: [
|
||||
"libclat",
|
||||
"libip_checksum",
|
||||
"libmodules-utils-build",
|
||||
"libnetjniutils",
|
||||
"libnet_utils_device_common_bpfjni",
|
||||
"libtraffic_controller",
|
||||
"netd_aidl_interface-lateststable-ndk",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libcutils",
|
||||
"libnetdutils",
|
||||
"liblog",
|
||||
"libnativehelper",
|
||||
"libnetworkstats",
|
||||
],
|
||||
apex_available: [
|
||||
"com.android.tethering",
|
||||
|
||||
@@ -17,11 +17,15 @@
|
||||
#include <nativehelper/JNIHelp.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include <android-modules-utils/sdk_level.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
int register_com_android_server_TestNetworkService(JNIEnv* env);
|
||||
int register_com_android_server_connectivity_ClatCoordinator(JNIEnv* env);
|
||||
int register_com_android_server_BpfNetMaps(JNIEnv* env);
|
||||
int register_android_server_net_NetworkStatsFactory(JNIEnv* env);
|
||||
int register_android_server_net_NetworkStatsService(JNIEnv* env);
|
||||
|
||||
extern "C" jint JNI_OnLoad(JavaVM* vm, void*) {
|
||||
JNIEnv *env;
|
||||
@@ -42,6 +46,16 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void*) {
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
if (android::modules::sdklevel::IsAtLeastT()) {
|
||||
if (register_android_server_net_NetworkStatsFactory(env) < 0) {
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
if (register_android_server_net_NetworkStatsService(env) < 0) {
|
||||
return JNI_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
return JNI_VERSION_1_6;
|
||||
}
|
||||
|
||||
|
||||
@@ -167,6 +167,7 @@ android_test {
|
||||
"services.net",
|
||||
],
|
||||
jni_libs: [
|
||||
"libandroid_net_connectivity_com_android_net_module_util_jni",
|
||||
"libservice-connectivity",
|
||||
"libandroid_net_connectivity_com_android_net_module_util_jni",
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user