fix(input): release a mouse Back right click on focus loss and pass nav Back through

Address review: a navigation-bar Back that arrives while an injected mouse
Back is held now stays Back instead of releasing the right button early.
A held right button is released on pause, focus loss and input-device
removal, like the other held Back handling. While the session is
suspended or still loading, Back is no longer sent to the guest.
This commit is contained in:
Omar Al Taki authored and Kurt Himebauch committed 2026-11-05 12:13:51 -05:00
1 parent 57b3623a9a
commit abb28792e8
3 files changed
+32 -3

No files matched your search

@@ -67,6 +67,24 @@ class MouseBackInputTest {
assertTrue(presses.isEmpty())
}
@Test fun navigationBarBackWhileAnInjectedBackIsHeldStaysBack() {
input.onKeyEvent(injected(KeyEvent.ACTION_DOWN), toGuest = true)
assertFalse(input.onKeyEvent(navigationBar(KeyEvent.ACTION_DOWN), toGuest = true))
assertFalse(input.onKeyEvent(navigationBar(KeyEvent.ACTION_UP), toGuest = true))
assertEquals(listOf(true), presses)
assertTrue(input.onKeyEvent(injected(KeyEvent.ACTION_UP), toGuest = true))
assertEquals(listOf(true, false), presses)
}
@Test fun cancelReleasesAHeldPressOnce() {
input.onKeyEvent(injected(KeyEvent.ACTION_DOWN), toGuest = true)
input.cancel()
assertEquals(listOf(true, false), presses)
input.onKeyEvent(injected(KeyEvent.ACTION_UP), toGuest = true)
input.cancel()
assertEquals(listOf(true, false), presses)
}
@Test fun controllerBackStaysBack() {
val source = InputDevice.SOURCE_GAMEPAD or InputDevice.SOURCE_KEYBOARD
assertFalse(input.onKeyEvent(key(KeyEvent.ACTION_DOWN, source = source), toGuest = true))