android: add fallback VPN permission

Some heavily customized OEMS may auto-deny VPN requests without exposing the setting. Show a fallback dialog for devices with no visible VPN panel.

Updates tailscale/tailscale#14095

Signed-off-by: kari-ts <kari@tailscale.com>
pull/662/head
kari-ts 6 months ago
parent 1ec621c382
commit 759d1061e9

@ -154,6 +154,15 @@ class MainActivity : ComponentActivity() {
} else {
TSLog.d("VpnPermission", "Permission was denied by the user")
vpnViewModel.setVpnPrepared(false)
AlertDialog.Builder(this)
.setTitle(R.string.vpn_permission_needed)
.setMessage(R.string.vpn_explainer)
.setPositiveButton(R.string.try_again) { _, _ ->
viewModel.showVPNPermissionLauncherIfUnauthorized()
}
.setNegativeButton(R.string.cancel, null)
.show()
}
}
}

@ -203,6 +203,7 @@ class MainViewModel(private val vpnViewModel: VpnViewModel) : IpnViewModel() {
fun showVPNPermissionLauncherIfUnauthorized() {
val vpnIntent = VpnService.prepare(App.get())
TSLog.d("VpnPermissions", "vpnIntent=$vpnIntent")
if (vpnIntent != null) {
vpnPermissionLauncher?.launch(vpnIntent)
} else {

@ -26,6 +26,8 @@
<string name="clear_search">Clear search</string>
<string name="off">Off</string>
<string name="on">On</string>
<string name="try_again">Try again</string>
<string name="cancel">Cancel</string>
<!-- Strings for the about screen -->
<string name="app_name" translatable="false">Tailscale</string>
@ -312,7 +314,6 @@
<string name="vpn_permission_denied">VPN permission denied</string>
<string name="multiple_vpn_explainer">Only one VPN can be active, and it appears another is already running. Before starting Tailscale, disable the other VPN.</string>
<string name="go_to_settings">Go to Settings</string>
<string name="cancel">Cancel</string>
<string name="subnet_routes">Subnet routes</string>
<string name="run_as_subnet_router_header">Advertise routes to machines that are not running Tailscale to make them available in your tailnet. Routes must be approved in the admin console.</string>
<string name="open_kb_article">Open KB Article</string>
@ -332,6 +333,10 @@
<string name="hostname">Hostname</string>
<string name="failed_to_save">Failed to save</string>
<!-- Strings for fallback VPN dialog -->
<string name="vpn_permission_needed">VPN permission needed</string>
<string name="vpn_explainer">Tailscale needs VPN access, but it looks like your device may not show VPN settings. If you are using another VPN app or have work policies, disable them first, then try again.</string>
<!-- Strings for the taildrop directory picker interstitial -->
<string name="taildrop_directory_picker_title">Taildrop Directory</string>
<string name="taildrop_directory_picker_body">You have not selected a directory for incoming taildrop transfers. Please select or create a target directory.</string>

Loading…
Cancel
Save