Add error handling of enabled "always-on" during VPN connection (#698)

* Always add awg-go version to the log
* Display an error message always when no vpn permission is granted
This commit is contained in:
albexk
2024-03-26 02:09:50 +03:00
committed by GitHub
parent 30bd264f17
commit 7730dd510c
8 changed files with 67 additions and 16 deletions
@@ -215,11 +215,9 @@ class AmneziaVpnService : VpnService() {
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
val isAlwaysOnCompat =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) isAlwaysOn
else intent?.component?.packageName != packageName
val isAlwaysOn = intent != null && intent.action == SERVICE_INTERFACE
if (isAlwaysOnCompat) {
if (isAlwaysOn) {
Log.d(TAG, "Start service via Always-on")
connect()
} else if (intent?.getBooleanExtra(AFTER_PERMISSION_CHECK, false) == true) {