Skip to content

Add option to toggle hardware keyboard support in settings#2251

Open
ikodbapc wants to merge 1 commit intoHeliBorg:mainfrom
ikodbapc:main
Open

Add option to toggle hardware keyboard support in settings#2251
ikodbapc wants to merge 1 commit intoHeliBorg:mainfrom
ikodbapc:main

Conversation

@ikodbapc
Copy link

Add toggle for hardware keyboard support

Summary

This PR adds a user-facing setting to enable/disable hardware keyboard support, replacing the hardcoded ProductionFlags.IS_HARDWARE_KEYBOARD_SUPPORTED = false flag.

Hardware keyboard support was disabled in v3.3 due to multiple issues (#1949, #1957, #2001, #2030, #2047). However, some users with physical keyboards need this functionality and are willing to accept potential issues. This change makes the feature opt-in rather than completely unavailable.

Changes

  • Added new preference PREF_ENABLE_HARDWARE_KEYBOARD (default: false)
  • Added toggle in Advanced settings: "Hardware keyboard support"
  • Summary text warns users: "Enable handling of physical keyboard input (experimental, may have issues)"
  • KeyboardActionListenerImpl now checks the setting instead of the production flag
  • Added debug logging in HardwareKeyboardEventDecoder for troubleshooting

Testing

Tested with Croatian QWERTZ physical keyboard layout. Special characters (č, ć, ž, š, đ) work correctly when:

  1. Setting is enabled in HeliBoard
  2. Correct layout is configured in Android's physical keyboard settings

Related issues

Partially addresses #1949, #1957 by giving users the option to enable hardware keyboard support despite known issues.

?: Event.NOT_A_CODE_POINT // KeyEvent has 0 if no codePoint, but that's actually valid so we convert it to -1

// Debug logging to understand hardware keyboard behavior
val charFromEvent = if (codePointAndFlags > 0) codePointAndFlags.toChar() else '?'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is potentially very sensitive data, there should definitely be no logging of all inputs.

@Helium314
Copy link
Collaborator

Proper implemetation would be better (and save me from a bunch of issues inevitably coming up again), but alright.

But please add it to the experimental section, then we don't need the prefs_enable_hardware_keyboard_summary.

@Helium314
Copy link
Collaborator

Any reason to keep the IS_HARDWARE_KEYBOARD_SUPPORTED production flag?

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.

2 participants