From 43d33ee76067f1d3bd8932ec78cd2640657ee217 Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Tue, 16 May 2023 18:50:39 +0900 Subject: [PATCH] Update FrameworksNetTestsLib dependencies on VPN In change ID: Ia2279bd1023296e3c949fa05bd74e921bf17da79, ConnectivityServiceTest dependencies on VpnManagerService were removed, adding a more limited dependency on LockdownVpnTracker instead. This updates the "keep" rules for services.core-vpn to reflect that. services.core-vpn is a subset of services.core that only includes the classes in the "keep" rules, and their dependencies. This is because ConnectivityServiceTests still depends on internal VPN classes, but other usage of hidden API should not be added to the tests. Using VpnManagerService causes problems for calculating coverage, as it has indirect dependencies on many classes that end up included in the test and show as uncovered in the dashboards including NetworkPolicyManagerService. The dependency on NPMS was found by looking at coverage reports and unzipping services.core-vpn.jar. The fact that it is included due to indirect dependencies from VpnManagerService was discovered by running a dependency analysis tool (https://depfind.sourceforge.io/) on services.core-vpn.jar in the out/ directory, with: $ bin/DependencyExtractor services.core-vpn.jar > /tmp/graph.xml $ bin/c2c /tmp/graph.xml -show-inbounds > /tmp/inbounds.txt And running a script on the /tmp/inbounds.txt graph to find the path from VpnManagerService to NPMS. Bug: 259632671 Test: m Change-Id: Idc6c9e6e998dbf968fd97582f904cb7aed56b5b5 --- tests/unit/vpn-jarjar-rules.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/vpn-jarjar-rules.txt b/tests/unit/vpn-jarjar-rules.txt index 16661b9ac3..1a6bddc89e 100644 --- a/tests/unit/vpn-jarjar-rules.txt +++ b/tests/unit/vpn-jarjar-rules.txt @@ -1,4 +1,4 @@ # Only keep classes imported by ConnectivityServiceTest -keep com.android.server.VpnManagerService keep com.android.server.connectivity.Vpn -keep com.android.server.connectivity.VpnProfileStore \ No newline at end of file +keep com.android.server.connectivity.VpnProfileStore +keep com.android.server.net.LockdownVpnTracker