Android: on-screen controls and touchpad input reach the console again #824

Open
aoleg94 wants to merge 2 commits from aoleg94/android-fix-touch-input into main
aoleg94 commented 2026-10-03 17:41:42 -05:00 (Migrated from github.com)

Summary

Since #791 the on-screen buttons, sticks and touchpad don't reach the console at all (sticks are
drawn moving, nothing arrives). Two causes:

  1. StreamActivity.onAttachFragment collects controllerState of each controls fragment into
    controlsJob. The stream layout hosts two fragments (on-screen controls and touchpad-only),
    so attaching the second one cancelled the first one's collection. Both are now merged
    (mergeControllerStates, combine + or).
  2. ControllerState.copy() shared the ControllerTouch objects while equals compares touches by
    content, so the touchpad's MutableStateFlow saw later touch changes in already published
    states and dropped touch moves and lifts as duplicates. Each state now owns its touches.

Taps and holds on the touchpad stick on the console until #823 is merged; the
cause is shared code, not Android.

Testing

  • New ControllerStateMergeTest; ControllerStateTest gains copy/touch tests that fail before
    the fix. ./gradlew testDebugUnitTest passes.
  • Galaxy Z Fold 4 (Android 13) + PS5: buttons, sticks, touchpad swipes, taps and holds work.

Notes

Developed with the assistance of Claude Code, and tested on real hardware as described above.

🤖 Generated with Claude Code

### Summary Since #791 the on-screen buttons, sticks and touchpad don't reach the console at all (sticks are drawn moving, nothing arrives). Two causes: 1. `StreamActivity.onAttachFragment` collects `controllerState` of each controls fragment into `controlsJob`. The stream layout hosts two fragments (on-screen controls and touchpad-only), so attaching the second one cancelled the first one's collection. Both are now merged (`mergeControllerStates`, `combine` + `or`). 2. `ControllerState.copy()` shared the `ControllerTouch` objects while `equals` compares touches by content, so the touchpad's `MutableStateFlow` saw later touch changes in already published states and dropped touch moves and lifts as duplicates. Each state now owns its touches. Taps and holds on the touchpad stick on the console until #823 is merged; the cause is shared code, not Android. ### Testing - New `ControllerStateMergeTest`; `ControllerStateTest` gains copy/touch tests that fail before the fix. `./gradlew testDebugUnitTest` passes. - Galaxy Z Fold 4 (Android 13) + PS5: buttons, sticks, touchpad swipes, taps and holds work. ### Notes Developed with the assistance of Claude Code, and tested on real hardware as described above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'aoleg94/android-fix-touch-input:aoleg94/android-fix-touch-input'
git switch 'aoleg94/android-fix-touch-input'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'aoleg94/android-fix-touch-input'
git switch 'aoleg94/android-fix-touch-input'
git rebase 'main'
git switch 'main'
git merge --ff-only 'aoleg94/android-fix-touch-input'
git switch 'aoleg94/android-fix-touch-input'
git rebase 'main'
git switch 'main'
git merge --no-ff 'aoleg94/android-fix-touch-input'
git switch 'main'
git merge --squash 'aoleg94/android-fix-touch-input'
git switch 'main'
git merge --ff-only 'aoleg94/android-fix-touch-input'
git switch 'main'
git merge 'aoleg94/android-fix-touch-input'
git push origin 'main'
Sign in to join this conversation.
No description provided.