Skip to content

android: add launcher shortcuts to connect and disconnect the VPN#810

Open
brettjenkins wants to merge 1 commit into
tailscale:mainfrom
brettjenkins:app-shortcuts
Open

android: add launcher shortcuts to connect and disconnect the VPN#810
brettjenkins wants to merge 1 commit into
tailscale:mainfrom
brettjenkins:app-shortcuts

Conversation

@brettjenkins

@brettjenkins brettjenkins commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds two static launcher shortcuts — Connect and Disconnect — backed by a transparent, no-UI AutomationActivity trampoline on the existing CONNECT_VPN / DISCONNECT_VPN intents. The actions can also be invoked from Samsung Modes & Routines and Tasker (Send Intent → Activity).

Why an activity rather than the existing broadcast

I wrote the original IPNReceiver broadcast support, and it worked reliably when it landed. Over successive Android releases the background-execution and power-saving restrictions have tightened (Doze, app standby, and OEM battery managers like Samsung's deep sleep), and the broadcast path has become unreliable at waking an app that's been stopped or slept — it often can't start the foreground VPN service from that state.

Starting an activity avoids this: it wakes the app and lets connect start the foreground VPN service. The existing broadcast actions are unchanged.

On-device validation

On a Galaxy S25 (SM-S948B, Android 16), with Tailscale put into deep sleep (hibernated + background-execution denied + restricted standby bucket + force-stopped) and triggered by real Tasker intents:

  • Broadcast → IPNReceiver: failed to connect
  • Activity → AutomationActivity: connected — both screen-on and screen-off

Notes for reviewers

  • Exported without a permission is deliberate: the same CONNECT/DISCONNECT actions are already reachable unguarded via the existing exported IPNReceiver. This adds an activity entry point for the reliable foreground-wake path, not new capability.
  • First run / not set up: if the user isn't logged in or VPN consent hasn't been granted, the shortcut opens the app (which owns login and the consent prompt) rather than one-tap connecting.
  • Exit-node automation is unchanged and remains available via the existing IPNReceiver USE_EXIT_NODE broadcast once connected.

Related issues

Implements the launcher-shortcut / automation requests in tailscale/tailscale#9531, tailscale/tailscale#9497, tailscale/tailscale#16415, tailscale/tailscale#17855, and tailscale/tailscale#17738, and improves the broadcast-intent reliability reported in tailscale/tailscale#10831, tailscale/tailscale#14148, tailscale/tailscale#13623, and tailscale/tailscale#18847.

Add an AutomationActivity trampoline and two static launcher shortcuts
(Connect, Disconnect) wired to the existing CONNECT_VPN / DISCONNECT_VPN
intents. The actions can also be invoked from Samsung Modes and Routines
or Tasker.

The activity exists because starting an activity reliably wakes an app
that the OS has force-stopped or deep-slept (e.g. Samsung battery
management) and lets connect start the foreground VPN service, whereas
the broadcast/Worker path is unreliable from that state.

Exit-node automation is unchanged and remains available via the existing
IPNReceiver USE_EXIT_NODE broadcast once the VPN is connected.

Updates tailscale/tailscale#10831
Updates tailscale/tailscale#14148
Updates tailscale/tailscale#13623
Updates tailscale/tailscale#18847
Updates tailscale/tailscale#9531
Updates tailscale/tailscale#9497
Updates tailscale/tailscale#16415
Updates tailscale/tailscale#17855
Updates tailscale/tailscale#17738

Signed-off-by: Brett Jenkins <brett@brettjenkins.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant