Merge "Fix that fail to setup any vpn after Network Settings reset and always-on vpn is on" into nyc-dev am: 265f4113ee

am: 508eec87ac

* commit '508eec87acc1867f7606d56f872d85662ec56a57':
  Fix that fail to setup any vpn after Network Settings reset and always-on vpn is on

Change-Id: I676da29aa5322563b20a95afd504e3b4d68fd2a0
This commit is contained in:
Robin Lee
2016-06-06 10:43:54 +00:00
committed by android-build-merger

View File

@@ -5205,6 +5205,15 @@ public class ConnectivityService extends IConnectivityManager.Stub
} }
if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) { if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
// Remove always-on package
synchronized (mVpns) {
final String alwaysOnPackage = getAlwaysOnVpnPackage(userId);
if (alwaysOnPackage != null) {
setAlwaysOnVpnPackage(userId, null, false);
setVpnPackageAuthorization(alwaysOnPackage, userId, false);
}
}
// Turn VPN off // Turn VPN off
VpnConfig vpnConfig = getVpnConfig(userId); VpnConfig vpnConfig = getVpnConfig(userId);
if (vpnConfig != null) { if (vpnConfig != null) {
@@ -5215,7 +5224,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
// in the future without user intervention. // in the future without user intervention.
setVpnPackageAuthorization(vpnConfig.user, userId, false); setVpnPackageAuthorization(vpnConfig.user, userId, false);
prepareVpn(vpnConfig.user, VpnConfig.LEGACY_VPN, userId); prepareVpn(null, VpnConfig.LEGACY_VPN, userId);
} }
} }
} }