Allow passing the underlying network to startLegacyVpn.

This will be used by a future change that makes the legacy
lockdown VPN pass the underlying network.

Bug: 173331190
Test: tests in subsequent CLs in stack
Change-Id: I09366a7f872ef3d4538962a75b0114a2ecb536e6
This commit is contained in:
Lorenzo Colitti
2021-01-29 20:34:38 +09:00
parent ab4b0cdccc
commit c5383dcb45
2 changed files with 3 additions and 2 deletions

View File

@@ -4838,7 +4838,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
} }
synchronized (mVpns) { synchronized (mVpns) {
throwIfLockdownEnabled(); throwIfLockdownEnabled();
mVpns.get(user).startLegacyVpn(profile, mKeyStore, egress); mVpns.get(user).startLegacyVpn(profile, mKeyStore, null /* underlying */, egress);
} }
} }

View File

@@ -148,6 +148,7 @@ public class VpnTest {
managedProfileA.profileGroupId = primaryUser.id; managedProfileA.profileGroupId = primaryUser.id;
} }
static final Network EGRESS_NETWORK = new Network(101);
static final String EGRESS_IFACE = "wlan0"; static final String EGRESS_IFACE = "wlan0";
static final String TEST_VPN_PKG = "com.testvpn.vpn"; static final String TEST_VPN_PKG = "com.testvpn.vpn";
private static final String TEST_VPN_SERVER = "1.2.3.4"; private static final String TEST_VPN_SERVER = "1.2.3.4";
@@ -963,7 +964,7 @@ public class VpnTest {
InetAddresses.parseNumericAddress("192.0.2.0"), EGRESS_IFACE); InetAddresses.parseNumericAddress("192.0.2.0"), EGRESS_IFACE);
lp.addRoute(defaultRoute); lp.addRoute(defaultRoute);
vpn.startLegacyVpn(vpnProfile, mKeyStore, lp); vpn.startLegacyVpn(vpnProfile, mKeyStore, EGRESS_NETWORK, lp);
return vpn; return vpn;
} }