Skip to content

Commit 50154cb

Browse files
authored
android: un-prepare VPN service on revocation (#748)
vpnPrepared tracks whether Tailscale holds VPN permission. When permission is revoked, the VPNService must be reestablished. If vpnPrepared stays true, the Go backend reconnects, but startVPN() is not called in the ConnectView and the tunnel is not reestablished Updates tailscale/tailscale#17190 Signed-off-by: kari-ts <kari@tailscale.com>
1 parent 58f641a commit 50154cb

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

android/src/main/java/com/tailscale/ipn/IPNService.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ open class IPNService : VpnService(), libtailscale.IPNService {
7878
// This means that we were restarted after the service was killed
7979
// (potentially due to OOM).
8080
if (UninitializedApp.get().isAbleToStartVPN()) {
81-
showForegroundNotification()
81+
showForegroundNotification()
8282
App.get()
8383
Libtailscale.requestVPN(this)
8484
START_STICKY
@@ -105,7 +105,10 @@ open class IPNService : VpnService(), libtailscale.IPNService {
105105
}
106106

107107
override fun onRevoke() {
108+
// VPN permission was granted to another app, so tell the Go backend and then set prepared to be
109+
// false so that when user attempts to connect again, VpnService.prepare() is called
108110
app.setWantRunning(false)
111+
setVpnPrepared(false)
109112
close()
110113
updateVpnStatus(false)
111114
super.onRevoke()

0 commit comments

Comments
 (0)