Skip to content

fix(android/app): Resize OSK when resuming app from background#8704

Merged
darcywong00 merged 1 commit intomasterfrom
fix/android/osk-on-resume
May 5, 2023
Merged

fix(android/app): Resize OSK when resuming app from background#8704
darcywong00 merged 1 commit intomasterfrom
fix/android/osk-on-resume

Conversation

@darcywong00
Copy link
Copy Markdown
Contributor

Fixes #8550
When Keyman app is in the foreground and the device is rotated, onConfigurationChanged() triggers which handles resizing the OSK.
If Keyman is in the background while the device is rotated, resuming the app does not trigger onConfigurationChanged().
This only affects the in-app keyboard. Note, on old Android devices (e.g. Android 5.0 / SDK 21), the app is recreated so the OSK always appears fine.

This PR adds a check to onResume() to handle resizing the OSK if needed.

User Testing

Setup - Install the PR build of Keyman for Android on a recent Android device/emulator (Anything newer than Android Oreo will do). Note, some Android devices use an "orientation" button on the navigation bar to trigger orientation changes. Press the button as necessary when rotating between portrait / landscape.

  • TEST_PORTRAIT_TO_LANDSCAPE - Verifies OSK is resized going from portrait to landscape orientation
  1. With the device in portrait orientation, launch Keyman for Android
  2. From the navigation bar, press the back button twice to dismiss "Get Started" menu and dismiss Keyman
  3. While Keyman is in the background rotate the device from portrait to landscape orientation.
  4. From the launcher, launch Keyman for Android
  5. When Keyman resumes, verify the OSK refreshes to fill the landscape orientation.
  • TEST_LANDSCAPE_TO_PORTRAIT - Verifies OSK is resized going from landscape to portrait orientation
  1. With the device in landscape orientation, launch Keyman for Android
  2. From the navigation bar, press the back button twice to dismiss "Get Started" menu and dismiss Keyman
  3. While Keyman is in the background rotate the device from landscape to portrait orientation.
  4. From the launcher, launch Keyman for Android
  5. When Keyman resumes, verify the OSK refreshes to fill the portrait orientation.

@darcywong00 darcywong00 requested a review from sgschantz as a code owner May 3, 2023 02:17
@keymanapp-test-bot keymanapp-test-bot bot added has-user-test user-test-required User tests have not been completed labels May 3, 2023
@keymanapp-test-bot
Copy link
Copy Markdown

keymanapp-test-bot bot commented May 3, 2023

User Test Results

Test specification and instructions

  • TEST_PORTRAIT_TO_LANDSCAPE (PASSED): Tested with the attached PR build (17.0.99-alpha-test-8704) in Android 12 / API 31 emulator and here is my observation: 1. Verified that the OSK refreshes to fills the landscape orientation. (notes)
  • TEST_LANDSCAPE_TO_PORTRAIT (PASSED): Verified that the OS refreshes to fill the portrait orientation. (notes)

Test Artifacts

@darcywong00 darcywong00 added this to the A17S16 milestone May 3, 2023
@darcywong00 darcywong00 modified the milestones: A17S16, A17S12 May 3, 2023
@github-actions github-actions bot added the fix label May 3, 2023
@bharanidharanj
Copy link
Copy Markdown

Test Results

  • TEST_PORTRAIT_TO_LANDSCAPE (PASSED): Tested with the attached PR build (17.0.99-alpha-test-8704) in Android 12 / API 31 emulator and here is my observation: 1. Verified that the OSK refreshes to fills the landscape orientation.

  • TEST_LANDSCAPE_TO_PORTRAIT (PASSED): Verified that the OS refreshes to fill the portrait orientation.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label May 3, 2023
Copy link
Copy Markdown
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

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

LGTM

@darcywong00 darcywong00 merged commit 46e2e80 into master May 5, 2023
@darcywong00 darcywong00 deleted the fix/android/osk-on-resume branch May 5, 2023 03:24
@mcdurdin
Copy link
Copy Markdown
Member

mcdurdin commented May 5, 2023

Should this be cherry-picked to stable?

@darcywong00
Copy link
Copy Markdown
Contributor Author

imho - the issue isn't a crash and the OSK refreshes when reorienting the app, so maybe we can skip cherry picking.

@keyman-server
Copy link
Copy Markdown
Collaborator

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(android): Inconsistent behavior of Keyboard after adjusting the OSK height for the current orientation (portrait or landscape)

4 participants