Allow jarjar com.android.server*
Jarjar com.android.server* and adjust the test by jarjar
FrameworksNetTestsLib to make sure the test cases still can access
package sope fields. Don't auto-jarjar non-connectivity module tests
in FrameworksNetTests because some non-connectivity module test cases
rely on service.core and service.net. The reason why not auto-jarjar
whole ConnectivityCoverageTests because tethering doesn't adopt
auto-jarjar-gen yet. The coverage test must jarjar the same as module so
that test coverage can calculate correctly.
Remove com.android.server* from proguard becasue it already be covered
by android.net* after jarjar'ed.
Move MetricsTestUtil to non connectivity module test group because it
only be used for IpConnectivityEventBuilderTest which is non connectivity
module test. Only jarjar the util without jarjar the caller make the test
failure.
Bug: 248001529
Test: atest ConnectivityCoverageTests FrameworksNetTests
Change-Id: I8439341ef4c03f29697fdf34557ea8ef2825d691
diff --git a/service/jarjar-excludes.txt b/service/jarjar-excludes.txt
index b0d6763..7bd3862 100644
--- a/service/jarjar-excludes.txt
+++ b/service/jarjar-excludes.txt
@@ -1,9 +1,3 @@
# Classes loaded by SystemServer via their hardcoded name, so they can't be jarjared
com\.android\.server\.ConnectivityServiceInitializer(\$.+)?
com\.android\.server\.NetworkStatsServiceInitializer(\$.+)?
-
-# Do not jarjar com.android.server, as several unit tests fail because they lose
-# package-private visibility between jarjared and non-jarjared classes.
-# TODO: fix the tests and also jarjar com.android.server, or at least only exclude a package that
-# is specific to the module like com.android.server.connectivity
-com\.android\.server\..+
diff --git a/service/jni/com_android_server_BpfNetMaps.cpp b/service/jni/com_android_server_BpfNetMaps.cpp
index 05f50b0..77cffda 100644
--- a/service/jni/com_android_server_BpfNetMaps.cpp
+++ b/service/jni/com_android_server_BpfNetMaps.cpp
@@ -236,7 +236,7 @@
// clang-format on
int register_com_android_server_BpfNetMaps(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "com/android/server/BpfNetMaps",
+ return jniRegisterNativeMethods(env, "android/net/connectivity/com/android/server/BpfNetMaps",
gMethods, NELEM(gMethods));
}
diff --git a/service/jni/com_android_server_TestNetworkService.cpp b/service/jni/com_android_server_TestNetworkService.cpp
index bd74d54..7aeecfa 100644
--- a/service/jni/com_android_server_TestNetworkService.cpp
+++ b/service/jni/com_android_server_TestNetworkService.cpp
@@ -151,8 +151,9 @@
};
int register_com_android_server_TestNetworkService(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "com/android/server/TestNetworkService", gMethods,
- NELEM(gMethods));
+ return jniRegisterNativeMethods(env,
+ "android/net/connectivity/com/android/server/TestNetworkService", gMethods,
+ NELEM(gMethods));
}
}; // namespace android
diff --git a/service/jni/com_android_server_connectivity_ClatCoordinator.cpp b/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
index 7060958..5b42659 100644
--- a/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
+++ b/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
@@ -477,8 +477,9 @@
};
int register_com_android_server_connectivity_ClatCoordinator(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "com/android/server/connectivity/ClatCoordinator",
- gMethods, NELEM(gMethods));
+ return jniRegisterNativeMethods(env,
+ "android/net/connectivity/com/android/server/connectivity/ClatCoordinator",
+ gMethods, NELEM(gMethods));
}
}; // namespace android
diff --git a/service/proguard.flags b/service/proguard.flags
index 864a28b..cf25f05 100644
--- a/service/proguard.flags
+++ b/service/proguard.flags
@@ -7,7 +7,7 @@
*;
}
--keepclassmembers class com.android.server.**,android.net.**,com.android.networkstack.** {
+-keepclassmembers class android.net.**,com.android.networkstack.** {
static final % POLICY_*;
static final % NOTIFY_TYPE_*;
static final % TRANSPORT_*;