mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 15:56:01 +00:00
Preserve replacement session Deck input routing
This commit is contained in:
1 parent
63004567fd
commit
7b7722bd25
4 files changed
+48
-1
No files matched your search
@@ -5115,7 +5115,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
padBridge?.setInputEnabled(false)
|
padBridge?.setInputEnabled(false)
|
||||||
physicalInputBindings?.close()
|
physicalInputBindings?.close()
|
||||||
padBridge?.stop()
|
padBridge?.stop()
|
||||||
DeckControls.setRouter(null)
|
DeckControls.clearRouter(inputRouter)
|
||||||
inputRouter = null
|
inputRouter = null
|
||||||
heldKeys.clear()
|
heldKeys.clear()
|
||||||
heldButtons.clear()
|
heldButtons.clear()
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ object DeckControls {
|
|||||||
publish()
|
publish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun clearRouter(owner: InputRouter?) {
|
||||||
|
if (owner != null && router === owner) setRouter(null)
|
||||||
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun source(role: InputRole, routed: Boolean = false) = Source(role, routed)
|
fun source(role: InputRole, routed: Boolean = false) = Source(role, routed)
|
||||||
|
|||||||
@@ -136,6 +136,41 @@ class InputSourceOwnershipTest {
|
|||||||
} finally { surface.close() }
|
} finally { surface.close() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test fun clearingOldDeckOwnerPreservesReplacementBindingsAndHeldKeys() {
|
||||||
|
val previous = InputRouter(RecordingOutput())
|
||||||
|
val output = RecordingOutput()
|
||||||
|
val replacement = InputRouter(output).also {
|
||||||
|
it.setProfile(InputProfile.defaults(InputProfile.GAME)
|
||||||
|
.withBinding(InputRole.PHYSICAL, InputControl.L4, InputAction.Keys(listOf(57))))
|
||||||
|
}
|
||||||
|
DeckControls.setRouter(previous)
|
||||||
|
DeckControls.setRouter(replacement)
|
||||||
|
DeckControls.setGrip(DeckControls.L4, true)
|
||||||
|
DeckControls.clearRouter(previous)
|
||||||
|
DeckControls.clearRouter(null)
|
||||||
|
assertEquals(listOf("key 57 true"), output.events)
|
||||||
|
DeckControls.setGrip(DeckControls.L4, false)
|
||||||
|
DeckControls.setGrip(DeckControls.L4, true)
|
||||||
|
assertEquals(listOf("key 57 true", "key 57 false", "key 57 true"), output.events)
|
||||||
|
assertEquals(0, JoyConPadTest.RecordingWriter.grips)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test fun clearingCurrentDeckOwnerReleasesItsKeysAndRemovesBindings() {
|
||||||
|
val output = RecordingOutput()
|
||||||
|
val router = InputRouter(output).also {
|
||||||
|
it.setProfile(InputProfile.defaults(InputProfile.GAME)
|
||||||
|
.withBinding(InputRole.PHYSICAL, InputControl.L4, InputAction.Keys(listOf(57))))
|
||||||
|
}
|
||||||
|
DeckControls.setRouter(router)
|
||||||
|
DeckControls.setGrip(DeckControls.L4, true)
|
||||||
|
DeckControls.clearRouter(router)
|
||||||
|
DeckControls.clearRouter(router)
|
||||||
|
DeckControls.setGrip(DeckControls.L4, false)
|
||||||
|
DeckControls.setGrip(DeckControls.L4, true)
|
||||||
|
assertEquals(listOf("key 57 true", "key 57 false"), output.events)
|
||||||
|
assertEquals(DeckControls.L4, JoyConPadTest.RecordingWriter.grips)
|
||||||
|
}
|
||||||
|
|
||||||
@Test fun releasingAllKeepsPhysicalGripsBlockedUntilNeutral() {
|
@Test fun releasingAllKeepsPhysicalGripsBlockedUntilNeutral() {
|
||||||
val router = InputRouter(RecordingOutput())
|
val router = InputRouter(RecordingOutput())
|
||||||
bridge.setInputRouter(router)
|
bridge.setInputRouter(router)
|
||||||
|
|||||||
@@ -42,6 +42,13 @@ Actual display captures and test reports are retained locally under
|
|||||||
`app/build/reports/input-publish/`. Screenshot publication is subject to the
|
`app/build/reports/input-publish/`. Screenshot publication is subject to the
|
||||||
user's review. No new latency measurement was made for this UI revision.
|
user's review. No new latency measurement was made for this UI revision.
|
||||||
|
|
||||||
|
The follow-up router-ownership fix passed **47 tests** in `InputSourceOwnershipTest`,
|
||||||
|
`InputSurfaceSourceTest`, and `InputRouterTest`, including two new regressions.
|
||||||
|
An obsolete activity (or one without a router) cannot detach the replacement
|
||||||
|
activity's Deck routes; the current owner still releases its held keys on cleanup.
|
||||||
|
This follow-up changes teardown only and was not reinstalled or retested on Thor,
|
||||||
|
which was no longer available over ADB after the screenshot pass.
|
||||||
|
|
||||||
## Input settings polish, 2026-11-06
|
## Input settings polish, 2026-11-06
|
||||||
|
|
||||||
The final input/UI host run passed **941 tests in 124 suites, zero failures**.
|
The final input/UI host run passed **941 tests in 124 suites, zero failures**.
|
||||||
|
|||||||
Reference in new issue
Block a user