Network Reset should have a lockdown like Factory Reset.

bug:20332322
Change-Id: I7c61a011d11e89513757f112abf320bb2a785edb
(cherry picked from commit 94b038bbb291431a7b39611d72f206b07e839891)
This commit is contained in:
Stuart Scott
2015-04-20 14:07:45 -07:00
parent 16d8795df6
commit d198fe197b

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);
}
} }
} }
} }