Stop depending on shims in CtsHostsideNetworkTests.

These are no longer necessary, and now that udc-mainline-prod is
gone, we are moving away from shims entirely.

Bug: 365191921
Test: test-only change
Change-Id: Ia441170c25a04d7b146b48e170d53e0916d49ecf
This commit is contained in:
Lorenzo Colitti 2024-09-20 13:18:02 +09:00
commit 2f87cc0610
4 changed files with 6 additions and 25 deletions

View file

@ -54,9 +54,6 @@ android_test_helper_app {
"framework-connectivity-test-defaults",
"CtsHostsideNetworkTestsAppDefaults",
],
static_libs: [
"NetworkStackApiStableShims",
],
}
android_test_helper_app {
@ -67,7 +64,4 @@ android_test_helper_app {
"CtsHostsideNetworkTestsAppDefaults",
"ConnectivityNextEnableDefaults",
],
static_libs: [
"NetworkStackApiCurrentShims",
],
}

View file

@ -29,9 +29,6 @@ import android.util.Log;
import android.util.Pair;
import com.android.modules.utils.build.SdkLevel;
import com.android.networkstack.apishim.VpnServiceBuilderShimImpl;
import com.android.networkstack.apishim.common.UnsupportedApiLevelException;
import com.android.networkstack.apishim.common.VpnServiceBuilderShim;
import com.android.testutils.PacketReflector;
import java.io.IOException;
@ -102,8 +99,7 @@ public class MyVpnService extends VpnService {
}
private void start(String packageName, Intent intent) {
Builder builder = new Builder();
VpnServiceBuilderShim vpnServiceBuilderShim = VpnServiceBuilderShimImpl.newInstance();
VpnService.Builder builder = new VpnService.Builder();
final String addresses = parseIpAndMaskListArgument(packageName, intent, "addresses",
builder::addAddress);
@ -112,11 +108,7 @@ public class MyVpnService extends VpnService {
if (SdkLevel.isAtLeastT() && intent.getBooleanExtra(packageName + ".addRoutesByIpPrefix",
false)) {
addedRoutes = parseIpPrefixListArgument(packageName, intent, "routes", (prefix) -> {
try {
vpnServiceBuilderShim.addRoute(builder, prefix);
} catch (UnsupportedApiLevelException e) {
throw new RuntimeException(e);
}
builder.addRoute(prefix);
});
} else {
addedRoutes = parseIpAndMaskListArgument(packageName, intent, "routes",
@ -127,11 +119,7 @@ public class MyVpnService extends VpnService {
if (SdkLevel.isAtLeastT()) {
excludedRoutes = parseIpPrefixListArgument(packageName, intent, "excludedRoutes",
(prefix) -> {
try {
vpnServiceBuilderShim.excludeRoute(builder, prefix);
} catch (UnsupportedApiLevelException e) {
throw new RuntimeException(e);
}
builder.excludeRoute(prefix);
});
}

View file

@ -20,8 +20,11 @@ import static android.Manifest.permission.MANAGE_TEST_NETWORKS;
import static android.Manifest.permission.NETWORK_SETTINGS;
import static android.Manifest.permission.READ_DEVICE_CONFIG;
import static android.Manifest.permission.WRITE_DEVICE_CONFIG;
import static android.content.Context.RECEIVER_EXPORTED;
import static android.content.pm.PackageManager.FEATURE_TELEPHONY;
import static android.content.pm.PackageManager.FEATURE_WIFI;
import static android.net.ConnectivityManager.BLOCKED_REASON_LOCKDOWN_VPN;
import static android.net.ConnectivityManager.BLOCKED_REASON_NONE;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_BACKGROUND;
import static android.net.ConnectivityManager.TYPE_VPN;
import static android.net.NetworkCapabilities.TRANSPORT_TEST;
@ -46,9 +49,6 @@ import static com.android.cts.net.hostside.VpnTest.TestSocketKeepaliveCallback.C
import static com.android.cts.net.hostside.VpnTest.TestSocketKeepaliveCallback.CallbackType.ON_RESUMED;
import static com.android.cts.net.hostside.VpnTest.TestSocketKeepaliveCallback.CallbackType.ON_STARTED;
import static com.android.cts.net.hostside.VpnTest.TestSocketKeepaliveCallback.CallbackType.ON_STOPPED;
import static com.android.networkstack.apishim.ConstantsShim.BLOCKED_REASON_LOCKDOWN_VPN;
import static com.android.networkstack.apishim.ConstantsShim.BLOCKED_REASON_NONE;
import static com.android.networkstack.apishim.ConstantsShim.RECEIVER_EXPORTED;
import static com.android.testutils.Cleanup.testAndCleanup;
import static com.android.testutils.RecorderCallback.CallbackEntry.BLOCKED_STATUS_INT;
import static com.android.testutils.TestPermissionUtil.runAsShell;

View file

@ -26,7 +26,6 @@ android_test_helper_app {
static_libs: [
"androidx.annotation_annotation",
"CtsHostsideNetworkTestsAidl",
"NetworkStackApiStableShims",
],
srcs: ["src/**/*.java"],
// Tag this module as a cts test artifact