Skip to content

Commit a6079c4

Browse files
committed
android: require confirmation before disabling remote client logging
Reword the subtitle and add a confirmation dialog when toggling remote client logging off, since disabling breaks Network Flow Logs (if required by the tailnet admin) and blocks Tailscale Support from debugging problems on the device. Turning logging back on remains a single tap. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
1 parent a844e66 commit a6079c4

2 files changed

Lines changed: 40 additions & 2 deletions

File tree

android/src/main/java/com/tailscale/ipn/ui/view/SettingsView.kt

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@ import androidx.compose.foundation.layout.Column
88
import androidx.compose.foundation.layout.padding
99
import androidx.compose.foundation.rememberScrollState
1010
import androidx.compose.foundation.verticalScroll
11+
import androidx.compose.material3.AlertDialog
1112
import androidx.compose.material3.ListItem
1213
import androidx.compose.material3.MaterialTheme
1314
import androidx.compose.material3.Scaffold
1415
import androidx.compose.material3.Text
16+
import androidx.compose.material3.TextButton
1517
import androidx.compose.runtime.Composable
1618
import androidx.compose.runtime.collectAsState
1719
import androidx.compose.runtime.getValue
20+
import androidx.compose.runtime.mutableStateOf
21+
import androidx.compose.runtime.remember
22+
import androidx.compose.runtime.setValue
1823
import androidx.compose.ui.Modifier
1924
import androidx.compose.ui.graphics.Color
2025
import androidx.compose.ui.platform.LocalUriHandler
@@ -59,6 +64,7 @@ fun SettingsView(
5964
val showTailnetLock by MDMSettings.manageTailnetLock.flow.collectAsState()
6065
val useTailscaleSubnets by MDMSettings.useTailscaleSubnets.flow.collectAsState()
6166
val isClientRemoteLoggingEnabled by viewModel.isClientRemoteLoggingEnabled.collectAsState()
67+
var showDisableLoggingDialog by remember { mutableStateOf(false) }
6268

6369
Scaffold(
6470
topBar = {
@@ -118,7 +124,13 @@ fun SettingsView(
118124
else R.string.client_remote_logging_enabled_subtitle),
119125
isOn = isClientRemoteLoggingEnabled,
120126
enabled = !MDMSettings.isMDMConfigured,
121-
onToggle = { viewModel.toggleIsClientRemoteLoggingEnabled() })
127+
onToggle = {
128+
if (isClientRemoteLoggingEnabled) {
129+
showDisableLoggingDialog = true
130+
} else {
131+
viewModel.toggleIsClientRemoteLoggingEnabled()
132+
}
133+
})
122134

123135
if (!AndroidTVUtil.isAndroidTV()) {
124136
Lists.ItemDivider()
@@ -149,6 +161,29 @@ fun SettingsView(
149161
}
150162
}
151163
}
164+
165+
if (showDisableLoggingDialog) {
166+
AlertDialog(
167+
onDismissRequest = { showDisableLoggingDialog = false },
168+
title = { Text(stringResource(R.string.client_remote_logging_disable_confirm_title)) },
169+
text = { Text(stringResource(R.string.client_remote_logging_disable_confirm_message)) },
170+
confirmButton = {
171+
TextButton(
172+
onClick = {
173+
showDisableLoggingDialog = false
174+
viewModel.toggleIsClientRemoteLoggingEnabled()
175+
}) {
176+
Text(
177+
stringResource(R.string.client_remote_logging_disable_confirm_button),
178+
color = MaterialTheme.colorScheme.error)
179+
}
180+
},
181+
dismissButton = {
182+
TextButton(onClick = { showDisableLoggingDialog = false }) {
183+
Text(stringResource(R.string.cancel))
184+
}
185+
})
186+
}
152187
}
153188

154189
object Setting {

android/src/main/res/values/strings.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,11 @@
355355
<string name="use_tailscale_subnets_subtitle">Route traffic according to your network\'s rules. Some networks require this to access IP addresses that don\'t start with 100.x.y.z.</string>
356356
<string name="subnet_routing">Subnet routing</string>
357357
<string name="client_remote_logging_enabled">Remote client logging</string>
358-
<string name="client_remote_logging_enabled_subtitle">Whether debug logs are uploaded to Tailscale support. When disabled no support or network flow logs.\nChanges require restarting the app to take effect.</string>
358+
<string name="client_remote_logging_enabled_subtitle">Whether debug &amp; opt-in flow logs are uploaded. Changes require restarting the app to take effect.</string>
359359
<string name="client_remote_logging_enabled_subtitle_mdm">Client logging is always enabled for devices under remote management.</string>
360+
<string name="client_remote_logging_disable_confirm_title">Disable remote client logging?</string>
361+
<string name="client_remote_logging_disable_confirm_message">Disabling remote client logging will break Network Flow Logs if enabled and required by your tailnet admin, and will prevent Tailscale Support from being able to help debug problems with this device.\n\nChanges require restarting the app to take effect.</string>
362+
<string name="client_remote_logging_disable_confirm_button">Yes, disable</string>
360363
<string name="specifies_a_device_name_to_be_used_instead_of_the_automatic_default">Specifies a device name to be used instead of the automatic default.</string>
361364
<string name="hostname">Hostname</string>
362365
<string name="failed_to_save">Failed to save</string>

0 commit comments

Comments
 (0)