Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da1a7ac3 authored by Koichi, Sugimoto's avatar Koichi, Sugimoto Committed by Robin Lee
Browse files

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
parent 7f9ed1cd
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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
            VpnConfig vpnConfig = getVpnConfig(userId);
            if (vpnConfig != null) {