mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 04:46:08 +00:00
fix: the Debugging tools hint points to Setup > Diagnostics (#725)
This commit is contained in:
1 parent
fc9d4d0646
commit
6e5be862cd
5 files changed
+13
-5
No files matched your search
@@ -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",
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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"))
|
||||
|
||||
Reference in new issue
Block a user