Move networkstats JNI to connectivity module

Reorganize networkstats JNI so it can be included in the connectivity
module.

Bug: 197717846
Test: m
Change-Id: I815ea379f3d9915041c80ac5e743ce62e05f4cf8
Merged-In: I815ea379f3d9915041c80ac5e743ce62e05f4cf8
This commit is contained in:
Remi NGUYEN VAN
2022-02-02 13:22:57 +09:00
committed by junyulai
parent 6b708138c1
commit f7c0b1fd9e
9 changed files with 34 additions and 24 deletions

View File

@@ -194,10 +194,9 @@ cc_library_shared {
"jni/onload.cpp",
],
shared_libs: [
"libandroid",
"liblog",
],
static_libs: [
"libnativehelper_compat_libc++",
"libnativehelper",
],
stl: "none",
apex_available: [

View File

@@ -40,6 +40,30 @@ filegroup {
],
}
// For test code only.
filegroup {
name: "lib_networkStatsFactory_native",
srcs: [
"jni/com_android_server_net_NetworkStatsFactory.cpp",
],
path: "jni",
visibility: [
"//packages/modules/Connectivity:__subpackages__",
],
}
filegroup {
name: "services.connectivity-netstats-jni-sources",
srcs: [
"jni/com_android_server_net_NetworkStatsFactory.cpp",
"jni/com_android_server_net_NetworkStatsService.cpp",
],
path: "jni",
visibility: [
"//packages/modules/Connectivity:__subpackages__",
],
}
// Nsd related libraries.
filegroup {

View File

@@ -54,6 +54,10 @@ import java.util.concurrent.ConcurrentHashMap;
* @hide
*/
public class NetworkStatsFactory {
static {
System.loadLibrary("service-connectivity");
}
private static final String TAG = "NetworkStatsFactory";
private static final boolean USE_NATIVE_PARSING = true;

View File

@@ -173,6 +173,10 @@ import java.util.concurrent.TimeUnit;
*/
@TargetApi(Build.VERSION_CODES.TIRAMISU)
public class NetworkStatsService extends INetworkStatsService.Stub {
static {
System.loadLibrary("service-connectivity");
}
static final String TAG = "NetworkStats";
static final boolean LOGD = Log.isLoggable(TAG, Log.DEBUG);
static final boolean LOGV = Log.isLoggable(TAG, Log.VERBOSE);

View File

@@ -178,10 +178,6 @@ cc_library_shared {
name: "libandroid_servers",
defaults: ["libservices.core-libs"],
whole_static_libs: ["libservices.core"],
required: [
// TODO: remove after NetworkStatsService is moved to the mainline module.
"libcom_android_net_module_util_jni",
],
}
platform_compat_config {

View File

@@ -47,7 +47,6 @@ cc_library_static {
"com_android_server_lights_LightsService.cpp",
"com_android_server_location_GnssLocationProvider.cpp",
"com_android_server_locksettings_SyntheticPasswordManager.cpp",
"com_android_server_net_NetworkStatsService.cpp",
"com_android_server_power_PowerManagerService.cpp",
"com_android_server_powerstats_PowerStatsService.cpp",
"com_android_server_hint_HintManagerService.cpp",
@@ -73,7 +72,6 @@ cc_library_static {
"com_android_server_sensor_SensorService.cpp",
"onload.cpp",
":lib_cachedAppOptimizer_native",
":lib_networkStatsFactory_native",
],
include_dirs: [
@@ -85,7 +83,6 @@ cc_library_static {
header_libs: [
"bionic_libc_platform_headers",
"bpf_connectivity_headers",
],
}
@@ -140,9 +137,6 @@ cc_defaults {
"libhidlbase",
"libutils",
"libhwui",
"libbpf_android",
"libnetdutils",
"libnetworkstats",
"libpsi",
"libdataloader",
"libincfs",
@@ -204,13 +198,6 @@ cc_defaults {
},
}
filegroup {
name: "lib_networkStatsFactory_native",
srcs: [
"com_android_server_net_NetworkStatsFactory.cpp",
],
}
filegroup {
name: "lib_cachedAppOptimizer_native",
srcs: [

View File

@@ -51,8 +51,6 @@ int register_android_server_Watchdog(JNIEnv* env);
int register_android_server_HardwarePropertiesManagerService(JNIEnv* env);
int register_android_server_SyntheticPasswordManager(JNIEnv* env);
int register_android_hardware_display_DisplayViewport(JNIEnv* env);
int register_android_server_net_NetworkStatsFactory(JNIEnv* env);
int register_android_server_net_NetworkStatsService(JNIEnv* env);
int register_android_server_am_CachedAppOptimizer(JNIEnv* env);
int register_android_server_am_LowMemDetector(JNIEnv* env);
int register_com_android_server_soundtrigger_middleware_AudioSessionProviderImpl(JNIEnv* env);
@@ -107,8 +105,6 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */)
register_android_server_SyntheticPasswordManager(env);
register_android_graphics_GraphicsStatsService(env);
register_android_hardware_display_DisplayViewport(env);
register_android_server_net_NetworkStatsFactory(env);
register_android_server_net_NetworkStatsService(env);
register_android_server_am_CachedAppOptimizer(env);
register_android_server_am_LowMemDetector(env);
register_com_android_server_soundtrigger_middleware_AudioSessionProviderImpl(env);