From 6e5be862cdc73059fc4b75fdd091d2a95de26715 Mon Sep 17 00:00:00 2001 From: Kirk Date: Wed, 14 Oct 2026 03:01:40 +0800 Subject: [PATCH] fix: the Debugging tools hint points to Setup > Diagnostics (#725) --- .../main/java/com/droiddeck/launcher/agent/AgentAccess.kt | 4 ++-- .../com/droiddeck/launcher/agent/AgentSecurityTest.kt | 8 ++++++++ docs/agent-control.md | 2 +- tools/droiddeckctl | 2 +- tools/tests/test_droiddeckctl.py | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/agent/AgentAccess.kt b/app/src/main/java/com/droiddeck/launcher/agent/AgentAccess.kt index e43ba8669c..b6828c7425 100644 --- a/app/src/main/java/com/droiddeck/launcher/agent/AgentAccess.kt +++ b/app/src/main/java/com/droiddeck/launcher/agent/AgentAccess.kt @@ -8,7 +8,7 @@ import android.content.Context * permission). Running commands in the guest, evaluating JavaScript in the Steam client, session * environment, binary overrides and preference writes reach inside the app's sandbox - the guest * holds the Steam login - which the shell of a stock device otherwise cannot. They require - * Setup > Session > Debugging tools to be on, in every build. The bridge itself cannot turn it on. + * Setup > Diagnostics > Debugging tools to be on, in every build. The bridge itself cannot turn it on. */ object AgentAccess { const val MAX_REQUEST_CHARS = 256 * 1024 @@ -33,7 +33,7 @@ object AgentAccess { fun requireCommands(context: Context) { if (!commandsAllowed(context)) throw AgentException( "AGENT_COMMANDS_DISABLED", - "Debugging tools are off: turn on Setup > Session > Debugging tools on the device", + "Debugging tools are off: turn on Setup > Diagnostics > Debugging tools on the device", ) } diff --git a/app/src/test/java/com/droiddeck/launcher/agent/AgentSecurityTest.kt b/app/src/test/java/com/droiddeck/launcher/agent/AgentSecurityTest.kt index 499645c3e8..df4bb15fc9 100644 --- a/app/src/test/java/com/droiddeck/launcher/agent/AgentSecurityTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/agent/AgentSecurityTest.kt @@ -7,6 +7,7 @@ import android.util.Base64 import androidx.compose.ui.semantics.SemanticsConfiguration import androidx.compose.ui.semantics.SemanticsProperties import androidx.compose.ui.text.AnnotatedString +import com.droiddeck.launcher.R import com.droiddeck.launcher.runtime.LinuxRuntime import org.json.JSONObject import org.junit.Assert.* @@ -68,6 +69,13 @@ class AgentSecurityTest { assertFalse(AgentAccess.commandsAllowed(context)) } + @Test fun theRefusalNamesTheSetupTabThatHoldsTheToggle() { + val refusal = refused("AGENT_COMMANDS_DISABLED") { AgentAccess.requireCommands(context) } + val tab = context.getString(R.string.setup_tab_diagnostics) + val toggle = context.getString(R.string.setup_agent_commands) + assertTrue(refusal.message, refusal.message!!.contains("Setup > $tab > $toggle")) + } + @Test fun runCannotBypassTheToggle() { refused("AGENT_COMMANDS_DISABLED") { AgentAccess.requireStart(context, JSONObject().put("mode", "run")) } AgentAccess.requireStart(context, JSONObject().put("mode", "steam")) diff --git a/docs/agent-control.md b/docs/agent-control.md index 62ad534ada..da7e780983 100644 --- a/docs/agent-control.md +++ b/docs/agent-control.md @@ -26,7 +26,7 @@ Player controls and observations work over authorized ADB on any build: `state`, `resume`, `wait`, `launch`, `quit`, `focus`, `input`, `ui`, `logs`, `screenshot`, `record`, `displays`, `wake`, and `access`. -**Setup > Session > Debugging tools** is off by default in every build, including debug builds. +**Setup > Diagnostics > Debugging tools** is off by default in every build, including debug builds. It enables `run`, `guest`, `cdp`, all `env` operations, `override`, and `prefs`. The toggle switches directly without a confirmation dialog. The bridge refuses to change it through `ui` or preference writes. The existing preference key, `setting-agent-commands` test tag, JSON command names, and diff --git a/tools/droiddeckctl b/tools/droiddeckctl index db21fa31a5..d7456a81af 100755 --- a/tools/droiddeckctl +++ b/tools/droiddeckctl @@ -300,7 +300,7 @@ def start_session(adb: str, serial: str, request: dict) -> dict: def require_commands(adb: str, serial: str) -> dict: access = checked(provider_call(adb, serial, "access"), "ACCESS_FAILED") if access.get("commands") is not True: - raise ControlError("Debugging tools are off: turn on Setup > Session > Debugging tools on the device", + raise ControlError("Debugging tools are off: turn on Setup > Diagnostics > Debugging tools on the device", "AGENT_COMMANDS_DISABLED") return access diff --git a/tools/tests/test_droiddeckctl.py b/tools/tests/test_droiddeckctl.py index 22330ded0a..9e3c87ac9d 100644 --- a/tools/tests/test_droiddeckctl.py +++ b/tools/tests/test_droiddeckctl.py @@ -193,7 +193,7 @@ class DroiddeckctlTest(FakeAdbTest): code, out = self.run_ctl("run", "/usr/bin/sh", "--", "-c", "true") self.assertEqual(7, code) self.assertEqual("AGENT_COMMANDS_DISABLED", out["error"]["code"]) - self.assertIn("Debugging tools", out["error"]["message"]) + self.assertIn("Setup > Diagnostics > Debugging tools", out["error"]["message"]) self.assertEqual(["access"], [c.get("method") for c in self.calls()]) def test_override_checks_names_before_pushing_any_file(self):