I'd like to programatically press another application's Quick Settings Tile, e.g. from the shell or Tasker.
In this particular case, I'd like to press ProtonVPN's tile in order to automate connecting and disconnecting.
After tearing apart the app, I found that I could reliably disconnect the VPN with:
su root -c am start-foreground-service -n com.protonvpn.android/org.strongswan.android.logic.CharonVpnService -a android.net.VpnService.DISCONNECT
I can sometimes connect with:
su root -c am start-foreground-service -n com.protonvpn.android/org.strongswan.android.logic.CharonVpnService -a android.net.VpnService
However, this is not very reliable as it's an internal mechanism that bypasses much of what the app does in the process of properly establishing a Quick Connect connection.
If there's an intent that will simulate what occurs when an app's tile is pressed, it should provide a much cleaner solution.
In this instance, the app has the service
com.protonvpn.android.components.QuickTileService and an intent action filter of
android.service.quicksettings.action.QS_TILE however I'm at a loss for where to go from there.