Network Reset should have a lockdown like Factory Reset.

bug:20332322
Change-Id: I7c61a011d11e89513757f112abf320bb2a785edb
This commit is contained in:
Stuart Scott
2015-04-20 14:07:45 -07:00
parent 73dc94036d
commit 7c7cecec4a

View File

@@ -4602,27 +4602,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);
}
} }
} }
} }