Disable always-on VPN in factoryReset

When network setting reset is started while always-on VPN is enabled,
application crash occurs with IllegalStateException in prepareVpn().

Therefore, it's necessary to also disable always-on VPN in factoryReset
before prepareVpn() when turning off VPN.

Bug: 29030858
Change-Id: I08c5406717dd7937d197c2e934a56d037477aafc
This commit is contained in:
Koichi, Sugimoto
2016-01-27 18:48:58 +09:00
committed by Robin Lee
parent 5f8aae1831
commit 45dbfe7c3e

View File

@@ -5206,6 +5206,18 @@ public class ConnectivityService extends IConnectivityManager.Stub
} }
} }
// Turn Always-on VPN off
if (mLockdownEnabled && userId == UserHandle.USER_SYSTEM) {
final long ident = Binder.clearCallingIdentity();
try {
mKeyStore.delete(Credentials.LOCKDOWN_VPN);
mLockdownEnabled = false;
setLockdownTracker(null);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
// Turn VPN off // Turn VPN off
VpnConfig vpnConfig = getVpnConfig(userId); VpnConfig vpnConfig = getVpnConfig(userId);
if (vpnConfig != null) { if (vpnConfig != null) {