From cd10c1c19cef3f26ce7dec48bd76c4009b0a2ebd Mon Sep 17 00:00:00 2001 From: Oleksandr Garmatin Date: Thu, 2 May 2024 01:04:35 +0300 Subject: [PATCH] fix: prevent app from being killed in VPN mode --- .../pan/alexander/tordnscrypt/vpn/service/ServiceVPN.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tordnscrypt/src/main/java/pan/alexander/tordnscrypt/vpn/service/ServiceVPN.java b/tordnscrypt/src/main/java/pan/alexander/tordnscrypt/vpn/service/ServiceVPN.java index a25f123f..feff8733 100644 --- a/tordnscrypt/src/main/java/pan/alexander/tordnscrypt/vpn/service/ServiceVPN.java +++ b/tordnscrypt/src/main/java/pan/alexander/tordnscrypt/vpn/service/ServiceVPN.java @@ -948,6 +948,13 @@ public void onTaskRemoved(Intent rootIntent) { loge("VPN service task removed " + this.hashCode()); + boolean vpnEnabled = defaultPreferences.get().getBoolean(VPN_SERVICE_ENABLED, false); + if (vpnEnabled) { + Intent starterIntent = new Intent(this, BootCompleteReceiver.class); + starterIntent.setAction(ALWAYS_ON_VPN); + sendBroadcast(starterIntent); + } + super.onTaskRemoved(rootIntent); } }