Skip to content

Android: Input & DeX Optimizations - #150

Merged
winnerspiros merged 4 commits into
masterfrom
android-input-dex-optimizations-v2-240020163534789066
Apr 4, 2026
Merged

Android: Input & DeX Optimizations#150
winnerspiros merged 4 commits into
masterfrom
android-input-dex-optimizations-v2-240020163534789066

Conversation

@google-labs-jules

Copy link
Copy Markdown

Optimized Android input handling (S Pen, Keyboard, Mouse) and DeX high-refresh-rate display targeting. Fixes issues where S Pen would trigger touch mode, physical keyboards were unresponsive, and mouse back buttons closed the game. Enables manual display/resolution selection in Android settings.


PR created automatically by Jules for task 240020163534789066 started by @winnerspiros

This PR addresses several long-standing issues with input and high-refresh-rate displays on Android, particularly for Samsung DeX and S Pen users.

Key Improvements:
- **S Pen / Stylus**: Intercepted stylus events in `OsuGameActivity` to prevent them from triggering Android's system 'touch mode'. This fixes the issue where the cursor would disappear or the game would auto-switch to touch controls when the S Pen was used.
- **Physical Keyboards**: Broadened the input source check in `AndroidKeyboardHandler` to correctly identify and accept key events from Bluetooth and USB external keyboards that were previously being ignored.
- **Mouse Navigation**: Mapped the mouse back side button (Keycode.Back) to the in-game 'Escape' action. This prevents the mouse back button from closing the application and allows it to be used for menu navigation.
- **DeX Refresh Rate**: Upgraded `SelectHighestRefreshRate` to use `DisplayManager` for identifying external monitors. The game now specifically targets the monitor it is displayed on to apply the highest available refresh rate (e.g., 120Hz/240Hz).
- **Settings UI**: Enabled 'Display' and 'Resolution' settings on Android. Users in DeX mode can now manually select their preferred monitor and display mode if the automatic selection does not match their expectations.

These changes significantly improve the experience on high-end devices like the Galaxy S23 Ultra when used in a desktop-like environment.
@google-labs-jules

Copy link
Copy Markdown
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

This PR addresses several long-standing issues with input and high-refresh-rate displays on Android, particularly for Samsung DeX and S Pen users.

Key Improvements:
- **S Pen / Stylus**: Intercepted stylus events in `OsuGameActivity` to prevent them from triggering Android's system 'touch mode'. This fixes the issue where the cursor would disappear or the game would auto-switch to touch controls when the S Pen was used.
- **Physical Keyboards**: Broadened the input source check in `AndroidKeyboardHandler` to correctly identify and accept key events from Bluetooth and USB external keyboards. Fixed build error with `KeyboardType.None`.
- **Mouse Navigation**: Mapped the mouse back side button (Keycode.Back) to the in-game 'Escape' action. This prevents the mouse back button from closing the application and allows it to be used for menu navigation.
- **DeX Refresh Rate**: Upgraded `SelectHighestRefreshRate` to use `DisplayManager` for identifying external monitors. The game now specifically targets the monitor it is displayed on to apply the highest available refresh rate. Fixed build errors related to `Display.Mode` ambiguity.
- **Settings UI**: Enabled 'Display' and 'Resolution' settings on Android. Users in DeX mode can now manually select their preferred monitor and display mode if the automatic selection does not match their expectations.

These changes significantly improve the experience on high-end devices like the Galaxy S23 Ultra when used in a desktop-like environment.
- Fixed S Pen input: Intercept stylus events to prevent Android's 'touch mode' from hiding the cursor.
- Fixed Physical Keyboards: Broadened source check and fixed compilation errors with `InputKeyboardType`.
- Fixed Mouse: Mapped side back button to Escape to prevent app close.
- Optimized DeX: Targeted external displays for high refresh rate and fixed obsolete `Display.Width`.
- Enabled Display/Resolution settings on Android.
- Fixed Multiplayer test: Ensured generated test rooms have valid IDs to avoid 'inactive room' join errors.
- Fixed Android `Display.Mode` property access (using `PhysicalWidth`).
- Fixed Multiplayer test room initialization to avoid 'inactive room' errors.
- Corrected Stylus, Keyboard, and Mouse input handling for DeX and mobile.
- Enabled manual display/refresh rate selection on Android.
@winnerspiros
winnerspiros merged commit d6f8350 into master Apr 4, 2026
5 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant