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:
Remi NGUYEN VAN 2022-02-02 13:03:29 +09:00 • committed by Junyu Lai
commit d95048929c

View file

@ -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;
}