am d198fe19: Network Reset should have a lockdown like Factory Reset.

* commit 'd198fe197baf3cc72aba0ab6a2fe4f8602d97b0f':
  Network Reset should have a lockdown like Factory Reset.
This commit is contained in:
Stuart Scott
2015-06-01 16:45:42 +00:00
committed by Android Git Automerger

View File

@@ -4603,27 +4603,36 @@ public class ConnectivityService extends IConnectivityManager.Stub
@Override @Override
public void factoryReset() { public void factoryReset() {
enforceConnectivityInternalPermission(); enforceConnectivityInternalPermission();
if (mUserManager.hasUserRestriction(UserManager.DISALLOW_NETWORK_RESET)) {
return;
}
final int userId = UserHandle.getCallingUserId(); final int userId = UserHandle.getCallingUserId();
// Turn airplane mode off // Turn airplane mode off
setAirplaneMode(false); setAirplaneMode(false);
// Untether if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) {
for (String tether : getTetheredIfaces()) { // Untether
untether(tether); for (String tether : getTetheredIfaces()) {
untether(tether);
}
} }
// Turn VPN off if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
VpnConfig vpnConfig = getVpnConfig(userId); // Turn VPN off
if (vpnConfig != null) { VpnConfig vpnConfig = getVpnConfig(userId);
if (vpnConfig.legacy) { if (vpnConfig != null) {
prepareVpn(VpnConfig.LEGACY_VPN, VpnConfig.LEGACY_VPN, userId); if (vpnConfig.legacy) {
} else { prepareVpn(VpnConfig.LEGACY_VPN, VpnConfig.LEGACY_VPN, userId);
// Prevent this app (packagename = vpnConfig.user) from initiating VPN connections } else {
// in the future without user intervention. // Prevent this app (packagename = vpnConfig.user) from initiating VPN connections
setVpnPackageAuthorization(vpnConfig.user, userId, false); // in the future without user intervention.
setVpnPackageAuthorization(vpnConfig.user, userId, false);
prepareVpn(vpnConfig.user, VpnConfig.LEGACY_VPN, userId); prepareVpn(vpnConfig.user, VpnConfig.LEGACY_VPN, userId);
}
} }
} }
} }