fix(input): keep Steam's touch controller plugged while its layout is hidden

This commit is contained in:
Kurt Himebauch committed 2026-11-18 23:05:03 -05:00
1 parent 732c97831d
commit b87da99d21
2 files changed
+18 -1

No files matched your search

@@ -5389,7 +5389,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
controls.releaseAll(); controls.visibility = View.GONE
if (!plan.shown) { steam.cancelEditing(); steam.releaseAll() }
steam.visibility = if (plan.shown) View.VISIBLE else View.GONE
com.droiddeck.launcher.input.SteamTouchDevice.current?.plugged = plan.shown
// Steam takes seconds to configure a newly plugged touch controller, so hiding the layout keeps it plugged.
com.droiddeck.launcher.input.SteamTouchDevice.current?.plugged = true
applyTouchRouting()
return
}
@@ -96,6 +96,22 @@ class SessionKeyboardPadTest {
assertEquals(SessionPrefs.TOUCH_OFF, routedTouchMode())
}
@Test fun hidingTheSteamLayoutForAControllerKeepsSteamsTouchControllerPlugged() {
SteamTouchDevice.prepare(directory)
val steam = SteamTouchControls(activity, SteamTouchDevice.current!!, {}, {})
ReflectionHelpers.setField(activity, "steamTouchControls", steam)
SessionPrefs.setOscMode(activity, SessionPrefs.OSC_AUTO)
SessionPrefs.setSteamTouchLayout(activity, true)
ReflectionHelpers.setField(activity, "controlsHiddenByTap", true)
update()
assertEquals(View.GONE, steam.visibility)
assertTrue(SteamTouchDevice.current!!.plugged)
ReflectionHelpers.setField(activity, "controlsHiddenByTap", false)
update()
assertEquals(View.VISIBLE, steam.visibility)
assertTrue(SteamTouchDevice.current!!.plugged)
}
@Test fun endingTheAgentForgetsSteamsKeyboard() {
steamKeyboard(true)
AgentGuest.stop()