Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): use main looper to dispatch key events when OSK is hidden #12871

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

jahorton
Copy link
Contributor

Fixes: #12366
Supersedes: #12381

Alas, it would appear that we cannot rely on the WebView's version of postDelayed, as apparently that doesn't actually trigger delayed events when the WebView has been detached! We can, however, construct a Handler instance and link it to the UI thread's looper in order to achieve our desired effect.

User Testing

Setup - Install the PR build of Keyman for Android on a physical device. Also pair an external keyboard (USB/bluetooth) to the device

TEST_KEYBOARD - Verifies external keyboard works when virtual keyboard hidden

  1. Launch Keyman
  2. From "Get Started", enable Keyman as the default system keyboard
  3. Launch a separate app where you can type in (ideally a note taking app like Keep or OneNote as reported in the issue). If those aren't available, Chrome browser works
  4. Select a text area with Keyman sil_euro_latin selected as the system keyboard
  5. Verify the system keyboard types fine (longpresses, switching, keys, etc).
  6. With the virtual keyboard displayed, type on the physical keyboard ` a
  7. Verify the text becomes à.
  8. From the Android system preferences, select "Language and Keyboard" --> Physical keyboard --> Toggle "show on-screen keyboard" so that the OSK is hidden
  9. Return to the note-taking / Chrome app and select a text field
  10. Type on the physical keyboard ` a
  11. Verify the text becomes à

Please repeat the test a few times, verifying that no errors are triggered during any attempt.

@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Jan 10, 2025

Copy link
Contributor

@darcywong00 darcywong00 left a comment

Choose a reason for hiding this comment

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

lgtm.
Thanks for finding this!

@darcywong00
Copy link
Contributor

darcywong00 commented Jan 12, 2025

Can you also 🍒 pick to 17.0 so we can unblock the community site user?

nvm - I made the 🍒 pick in #12875

@jahorton jahorton changed the title fix(android): processing of hardware keystrokes when OSK is hidden fix(android): use main looper to dispatch key events when OSK is hidden Jan 13, 2025
@dinakaranr
Copy link

Test Results

I tested this issue with the attached "18.0.166-alpha-test-12871" build(15/01/2025) on an Android 14 physical device. I'm sharing my observation here.

  • TEST_KEYBOARD (Passed):
  1. Installed the "Keyman-18.0.166.apk" file from PR build and gave all permissions to the application.
  2. Open the Keyman app.
  3. Checked the "Enable Keyman as system-wide keyboard". Set the keyboard as the default keyboard box on the settings page.
  4. Connect the physical keyboard to the Android mobile.
  5. Open the google's Keep app.
  6. Select the text area app and select the sil_euro_latin selected as the system keyboard.
  7. Verified the system keyboard types in the text area.
  8. Verified the OSK appears on the keep app.
  9. Type the ` a using a physical keyboard.
  10. Verified the text became à.
  11. Hide the OSK screen in the Android mobile by selecting "Language and Keyboard" --> Physical keyboard --> Toggle "show on-screen keyboard"
  12. Return to the google's Keep app.
  13. Type the ` a using a physical keyboard.
  14. Verified the text became à.
    It works great for me. Thank you.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Jan 15, 2025
@jahorton jahorton merged commit 9f0051a into master Jan 16, 2025
6 checks passed
@jahorton jahorton deleted the fix/android/12366-keystrokes-with-hidden-osk branch January 16, 2025 01:15
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 18.0.168-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

bug(android): External physical keyboard doesn't type when virtual keyboard hidden
4 participants