From 25e7681c3250f5e97d8281010563d22fb57b340a Mon Sep 17 00:00:00 2001 From: kari-ts <135075563+kari-ts@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:41:48 -0700 Subject: [PATCH] android: set VPN status in service APIs (#522) This is mainly a no-op; right now we are setting the VPN status when we successfully edit prefs with wantRunning=false, but the VPN status is separate from tailscaled status and reflects the status of the VPN interface. This change moves that status update into the Android Service APIs. Updates tailscale/tailscale#12850 Updates tailscale/tailscale#12489 Signed-off-by: kari-ts --- android/src/main/java/com/tailscale/ipn/IPNService.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/tailscale/ipn/IPNService.kt b/android/src/main/java/com/tailscale/ipn/IPNService.kt index f7cc396..d33bad6 100644 --- a/android/src/main/java/com/tailscale/ipn/IPNService.kt +++ b/android/src/main/java/com/tailscale/ipn/IPNService.kt @@ -71,7 +71,7 @@ open class IPNService : VpnService(), libtailscale.IPNService { } override fun close() { - app.setWantRunning(false) { updateVpnStatus(false) } + app.setWantRunning(false) {} Notifier.setState(Ipn.State.Stopping) stopForeground(STOP_FOREGROUND_REMOVE) Libtailscale.serviceDisconnect(this) @@ -79,11 +79,13 @@ open class IPNService : VpnService(), libtailscale.IPNService { override fun onDestroy() { close() + updateVpnStatus(false) super.onDestroy() } override fun onRevoke() { close() + updateVpnStatus(false) super.onRevoke() }