diff --git a/build.gradle b/build.gradle index ec0443d6550d9ad17bbace116ef8b491ac40a8aa..23001fb178410108dc1ce1f247f8feca448e3bb0 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { ext.kotlin_version = "1.6.10" ext.orbot_version = "orbot-16.6.2" - ext.advanced_privacy_version = "1.3.0" + ext.advanced_privacy_version = "1.6.0-dev" repositories { google() diff --git a/privacymoduletor/src/main/java/foundation/e/privacymodules/ipscramblermodule/IpScramblerModule.kt b/privacymoduletor/src/main/java/foundation/e/privacymodules/ipscramblermodule/IpScramblerModule.kt index faabc8dee8519a1430189b90b862e485b3848449..17b0cdfefccdc3c91de3da384303d89cf98f59df 100644 --- a/privacymoduletor/src/main/java/foundation/e/privacymodules/ipscramblermodule/IpScramblerModule.kt +++ b/privacymoduletor/src/main/java/foundation/e/privacymodules/ipscramblermodule/IpScramblerModule.kt @@ -239,9 +239,17 @@ class IpScramblerModule(private val context: Context): IIpScramblerModule { action = OrbotConstants.ACTION_STOP, extra = Bundle().apply { putBoolean(ACTION_STOP_FOREGROUND_TASK, true) } ) + stoppingWatchdog(5) + } + + private fun stoppingWatchdog(countDown: Int) { Handler(Looper.getMainLooper()).postDelayed({ - requestStatus() - }, 1000) + if (isServiceRunning() && countDown > 0) { + stoppingWatchdog(countDown - 1) + } else { + updateStatus(Status.OFF, force = true) + } + }, 500) } override fun requestStatus() {