Merge "Add server information for pptp vpn"

am: 1421daa1c3

Change-Id: Ieacc3e883b759d1b95534011f46461c837c4e104
This commit is contained in:
Chenbo Feng
2019-05-23 22:22:35 -07:00
committed by android-build-merger

View File

@@ -1850,10 +1850,11 @@ public class Vpn {
if (!profile.searchDomains.isEmpty()) { if (!profile.searchDomains.isEmpty()) {
config.searchDomains = Arrays.asList(profile.searchDomains.split(" +")); config.searchDomains = Arrays.asList(profile.searchDomains.split(" +"));
} }
startLegacyVpn(config, racoon, mtpd); startLegacyVpn(config, racoon, mtpd, profile);
} }
private synchronized void startLegacyVpn(VpnConfig config, String[] racoon, String[] mtpd) { private synchronized void startLegacyVpn(VpnConfig config, String[] racoon, String[] mtpd,
VpnProfile profile) {
stopLegacyVpnPrivileged(); stopLegacyVpnPrivileged();
// Prepare for the new request. // Prepare for the new request.
@@ -1861,7 +1862,7 @@ public class Vpn {
updateState(DetailedState.CONNECTING, "startLegacyVpn"); updateState(DetailedState.CONNECTING, "startLegacyVpn");
// Start a new LegacyVpnRunner and we are done! // Start a new LegacyVpnRunner and we are done!
mLegacyVpnRunner = new LegacyVpnRunner(config, racoon, mtpd); mLegacyVpnRunner = new LegacyVpnRunner(config, racoon, mtpd, profile);
mLegacyVpnRunner.start(); mLegacyVpnRunner.start();
} }
@@ -1927,6 +1928,7 @@ public class Vpn {
private final String mOuterInterface; private final String mOuterInterface;
private final AtomicInteger mOuterConnection = private final AtomicInteger mOuterConnection =
new AtomicInteger(ConnectivityManager.TYPE_NONE); new AtomicInteger(ConnectivityManager.TYPE_NONE);
private final VpnProfile mProfile;
private long mBringupStartTime = -1; private long mBringupStartTime = -1;
@@ -1953,7 +1955,7 @@ public class Vpn {
} }
}; };
public LegacyVpnRunner(VpnConfig config, String[] racoon, String[] mtpd) { LegacyVpnRunner(VpnConfig config, String[] racoon, String[] mtpd, VpnProfile profile) {
super(TAG); super(TAG);
mConfig = config; mConfig = config;
mDaemons = new String[] {"racoon", "mtpd"}; mDaemons = new String[] {"racoon", "mtpd"};
@@ -1969,6 +1971,8 @@ public class Vpn {
// registering // registering
mOuterInterface = mConfig.interfaze; mOuterInterface = mConfig.interfaze;
mProfile = profile;
if (!TextUtils.isEmpty(mOuterInterface)) { if (!TextUtils.isEmpty(mOuterInterface)) {
final ConnectivityManager cm = ConnectivityManager.from(mContext); final ConnectivityManager cm = ConnectivityManager.from(mContext);
for (Network network : cm.getAllNetworks()) { for (Network network : cm.getAllNetworks()) {
@@ -2181,7 +2185,7 @@ public class Vpn {
} }
// Add a throw route for the VPN server endpoint, if one was specified. // Add a throw route for the VPN server endpoint, if one was specified.
String endpoint = parameters[5]; String endpoint = parameters[5].isEmpty() ? mProfile.server : parameters[5];
if (!endpoint.isEmpty()) { if (!endpoint.isEmpty()) {
try { try {
InetAddress addr = InetAddress.parseNumericAddress(endpoint); InetAddress addr = InetAddress.parseNumericAddress(endpoint);