diff --git a/app/build.gradle b/app/build.gradle index 32f0f5c..d2fee53 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { minSdkVersion 15 targetSdkVersion 29 - versionCode 30 - versionName "2.0.12" + versionCode 32 + versionName "2.0.14" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" setProperty("archivesBaseName", project.getParent().name+"-"+versionName) } diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/MainActivity.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/MainActivity.kt index 9bf848e..b4d56ab 100644 --- a/app/src/main/java/io/github/chronosx88/yggdrasil/MainActivity.kt +++ b/app/src/main/java/io/github/chronosx88/yggdrasil/MainActivity.kt @@ -398,6 +398,9 @@ class MainActivity : AppCompatActivity() { //TODO reimplement it private fun isYggServiceRunning(context: Context): Boolean { + if(this.intent.hasExtra(YggdrasilTunService.IS_VPN_SERVICE_STOPPED)){ + return !this.intent.getBooleanExtra(YggdrasilTunService.IS_VPN_SERVICE_STOPPED, true) + } val manager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager for (service in manager.getRunningServices(Int.MAX_VALUE)) { diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt index f5f0c6a..9c5f4d8 100644 --- a/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt +++ b/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt @@ -42,6 +42,7 @@ class YggdrasilTunService : VpnService() { companion object { private const val TAG = "Yggdrasil-service" + public const val IS_VPN_SERVICE_STOPPED = "VPN_STATUS" } private val FOREGROUND_ID = 1338 @@ -273,6 +274,7 @@ class YggdrasilTunService : VpnService() { "" } var intent = Intent(this, MainActivity::class.java) + intent.putExtra(IS_VPN_SERVICE_STOPPED, isClosed); var stackBuilder = TaskStackBuilder.create(this) stackBuilder.addNextIntentWithParentStack(intent) var pi = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)