Move reset network settings into framework.
bug: 16161518 Change-Id: Ic3b537ebd09d1b9723feff9dcc96e20fda05a94f
This commit is contained in:
@@ -40,6 +40,7 @@ import android.telephony.SubscriptionManager;
|
|||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.android.internal.net.VpnConfig;
|
||||||
import com.android.internal.telephony.ITelephony;
|
import com.android.internal.telephony.ITelephony;
|
||||||
import com.android.internal.telephony.PhoneConstants;
|
import com.android.internal.telephony.PhoneConstants;
|
||||||
import com.android.internal.util.Protocol;
|
import com.android.internal.util.Protocol;
|
||||||
@@ -2446,6 +2447,38 @@ public class ConnectivityManager {
|
|||||||
} catch (RemoteException e) {}
|
} catch (RemoteException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets all connectivity manager settings back to factory defaults.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void factoryReset() {
|
||||||
|
// Turn airplane mode off
|
||||||
|
setAirplaneMode(false);
|
||||||
|
|
||||||
|
// Untether
|
||||||
|
for (String tether : getTetheredIfaces()) {
|
||||||
|
untether(tether);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turn VPN off
|
||||||
|
try {
|
||||||
|
VpnConfig vpnConfig = mService.getVpnConfig();
|
||||||
|
if (vpnConfig != null) {
|
||||||
|
if (vpnConfig.legacy) {
|
||||||
|
mService.prepareVpn(VpnConfig.LEGACY_VPN, VpnConfig.LEGACY_VPN);
|
||||||
|
} else {
|
||||||
|
// Prevent this app from initiating VPN connections in the future without
|
||||||
|
// user intervention.
|
||||||
|
mService.setVpnPackageAuthorization(false);
|
||||||
|
|
||||||
|
mService.prepareVpn(vpnConfig.user, VpnConfig.LEGACY_VPN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
// Well, we tried
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds the current process to {@code network}. All Sockets created in the future
|
* Binds the current process to {@code network}. All Sockets created in the future
|
||||||
* (and not explicitly bound via a bound SocketFactory from
|
* (and not explicitly bound via a bound SocketFactory from
|
||||||
|
|||||||
Reference in New Issue
Block a user