Seems like Android can't handle more than one simultaneous VPN connection, and when I try to connect to Yggdrasil with OpenVPN still connected and with "always-on VPN" being enabled I get a quiet failure instead of an error message of any kind. When I do the same with the built-in L2TP VPN function instead of OpenVPN the app just crashes.
Stack trace of the crash:
2020-12-06 20:20:13.752 7848-7848/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: io.github.chronosx88.yggdrasil, PID: 7848
java.lang.IllegalStateException: Unavailable in lockdown mode
at android.os.Parcel.createException(Parcel.java:2079)
at android.os.Parcel.readException(Parcel.java:2039)
at android.os.Parcel.readException(Parcel.java:1987)
at android.net.IConnectivityManager$Stub$Proxy.prepareVpn(IConnectivityManager.java:2996)
at android.net.VpnService.prepare(VpnService.java:206)
at io.github.chronosx88.yggdrasil.MainActivity.startVpn(MainActivity.kt:228)
at io.github.chronosx88.yggdrasil.MainActivity.access$startVpn(MainActivity.kt:31)
at io.github.chronosx88.yggdrasil.MainActivity$onCreate$1.onCheckedChanged(MainActivity.kt:89)
at android.widget.CompoundButton.setChecked(CompoundButton.java:180)
at androidx.appcompat.widget.SwitchCompat.setChecked(SwitchCompat.java:1071)
at androidx.appcompat.widget.SwitchCompat.toggle(SwitchCompat.java:1066)
at android.widget.CompoundButton.performClick(CompoundButton.java:140)
at android.view.View.performClickInternal(View.java:7236)
at android.view.View.access$3600(View.java:801)
at android.view.View$PerformClick.run(View.java:27892)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.ConnectivityService.throwIfLockdownEnabled(ConnectivityService.java:4561)
at com.android.server.ConnectivityService.prepareVpn(ConnectivityService.java:4284)
at android.net.IConnectivityManager$Stub.onTransact(IConnectivityManager.java:1274)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)
Seems like Android can't handle more than one simultaneous VPN connection, and when I try to connect to Yggdrasil with OpenVPN still connected and with "always-on VPN" being enabled I get a quiet failure instead of an error message of any kind. When I do the same with the built-in L2TP VPN function instead of OpenVPN the app just crashes. Stack trace of the crash: