Skip to content

fix(android): Fix OSK rotation issues#10373

Merged
darcywong00 merged 2 commits intomasterfrom
fix/android/deprecated-rotation
Jan 16, 2024
Merged

fix(android): Fix OSK rotation issues#10373
darcywong00 merged 2 commits intomasterfrom
fix/android/deprecated-rotation

Conversation

@darcywong00
Copy link
Copy Markdown
Contributor

@darcywong00 darcywong00 commented Jan 12, 2024

Fixes #10241
Fixes #9978
Fixes #9191

There were multiple bugs related to OSK not filling the full width or not appearing after rotating the device orientation.

The main two fixes on this PR:

  • Disable multi-window (where modern Android devices try to split the screen so dimensions are "half"
  • The existing device orientation code would sporadically report PORTRAIT when the device was LANDSCAPE. Changing to getRotation() seems to have more consistent behavior.

User Testing

Setup - Install the PR build of Keyman for Android on the device/emulator. Some tests specify a specific Android SDK level

  • TEST_LANDSCAPE_KEYBOARD_PICKER - Verifies menu to adjust keyboard height works
  1. Install the PR build of Keyman for Android on an Android device/emulator
  2. with the device in Landscape mode, Launch Keyman and dismiss the Get Started menu
  3. In the Keyman app, type some letter using the OSK
  4. Longpress the globe key to display the keyboard picker menu
  5. Select the same keyboard from the picker menu
  6. Verify OSK is still full width
  • TEST_OSK_ROTATION_ANDROID_12
  1. Install the PR build of Keyman for Android on an Android device/emulator Android 12 (SDK 32)
  2. Open Keyman In-App.
  3. Open the Settings menu.
  4. Open Adjust keyboard height menu.
  5. Set the height to the maximum size.
  6. Revert to Keyman Home screen.
  7. Change the Orientation from Portrait to Landscape.
  8. Verify OSK displays and is full width.
  • TEST_OSK_ROTATION_ANDROID_13
  1. Install the PR build of Keyman for Android on an Android device/emulator Android 13 (SDK 33)
  2. Open Keyman In-App.
  3. Open the Settings menu.
  4. Open Adjust keyboard height menu.
  5. Set the height to the maximum size.
  6. Revert to Keyman Home screen.
  7. Change the Orientation from Portrait to Landscape.
  8. Verify OSK displays and is full width.

getConfiguration().orientation seems to be deprecated so changing to getRotation() for detecting PORTRAIT vs LANDSCAPE orientation

Reference:
https://developer.android.com/reference/android/view/Display#getRotation()
@keymanapp-test-bot keymanapp-test-bot bot added has-user-test user-test-required User tests have not been completed labels Jan 12, 2024
@keymanapp-test-bot
Copy link
Copy Markdown

keymanapp-test-bot bot commented Jan 12, 2024

User Test Results

Test specification and instructions

  • TEST_LANDSCAPE_KEYBOARD_PICKER (PASSED): Tested with the attached PR build (Keyman 17.0243-alpha-test-10373) in the Android 5.0 / API 21 emulator and here is my observation: 1. Verified that the OSK displayed with full width in the landscape mode. Seems to be working fine. (notes)
  • TEST_OSK_ROTATION_ANDROID_12 (PASSED): Tested with the attached PR build (Keyman 17.0243-alpha-test-10373) in the Android 12 / API 31 emulator and here is my observation: Verified that the OSK displayed with full width in the landscape mode. Seems to be working fine. (notes)
  • TEST_OSK_ROTATION_ANDROID_13 (PASSED): Tested with the attached PR build (Keyman 17.0243-alpha-test-10373) in the Android Mobile device (Android version 13 / Samsung Galaxy A23 5g) and here is my observation : Verified that the OSK displayed with full width in the landscape mode. Seems to be working fine. (notes)

Test Artifacts

@keymanapp-test-bot keymanapp-test-bot bot added this to the A17S30 milestone Jan 12, 2024
@darcywong00 darcywong00 marked this pull request as ready for review January 12, 2024 14:07
android:exported="true"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize"
android:label="@string/app_name"
android:resizeableActivity="false"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This disables the multi-window mode so Android won't use split-screen sizes.

@bharanidharanj
Copy link
Copy Markdown

  • TEST_OSK_ROTATION_ANDROID_13 (PASSED): Tested with the attached PR build (Keyman 17.0243-alpha-test-10373) in the Android Mobile device (Android version 13 / Samsung Galaxy A23 5g) and here is my observation : Verified that the OSK displayed with full width in the landscape mode. Seems to be working fine.

@bharanidharanj
Copy link
Copy Markdown

  • TEST_OSK_ROTATION_ANDROID_12 (PASSED): Tested with the attached PR build (Keyman 17.0243-alpha-test-10373) in the Android 12 / API 31 emulator and here is my observation: Verified that the OSK displayed with full width in the landscape mode. Seems to be working fine.

@bharanidharanj
Copy link
Copy Markdown

Test Results

  • TEST_LANDSCAPE_KEYBOARD_PICKER (PASSED): Tested with the attached PR build (Keyman 17.0243-alpha-test-10373) in the Android 5.0 / API 21 emulator and here is my observation: 1. Verified that the OSK displayed with full width in the landscape mode. Seems to be working fine.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Jan 12, 2024
@jahorton
Copy link
Copy Markdown
Contributor

jahorton commented Jan 15, 2024

#10054 tagged at least two of the issues being fixed by this PR. Granted, I don't think we have a consistent repro for it... but how likely do you think this PR fixing #10054 as well would be?

The main two fixes on this PR:

  • [...] The existing device orientation code would sporadically report PORTRAIT when the device was LANDSCAPE. Changing to getRotation() seems to have more consistent behavior.

#10054 looks like a LANDSCAPE report with the device in PORTRAIT to me.

@darcywong00 darcywong00 merged commit 6b79624 into master Jan 16, 2024
@darcywong00 darcywong00 deleted the fix/android/deprecated-rotation branch January 16, 2024 01:33
@keyman-server
Copy link
Copy Markdown
Collaborator

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

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