Skip to content

fix(android): fix loading of keyboards on Android#16146

Open
ermshiperete wants to merge 1 commit into
masterfrom
fix/android/16096_blankKeyboard
Open

fix(android): fix loading of keyboards on Android#16146
ermshiperete wants to merge 1 commit into
masterfrom
fix/android/16096_blankKeyboard

Conversation

@ermshiperete

@ermshiperete ermshiperete commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

This PR migrates the Android WebView from loading local files via file:// URLs to using WebViewAssetLoader, which serves internal storage files through a magic HTTPS domain (https://appassets.androidplatform.net). This fixes the blank keyboard problem reported in #16096 for Android.

Core pattern of the change:

// Before:
"file://" + context.getDir("data", ...)
  + "/" + filename
// After:
"https://appassets.androidplatform.net"
  + "/data/" + filename

The WebViewAssetLoader in KMKeyboardWebViewClient intercepts requests to this domain and serves files from internal storage. Since the domain is a constant, Context is no longer needed to construct URLs, simplifying several method signatures.

Also this PR makes KMKeyboard.getKeyboardRoot() private, and renames public Keyboard.getKeyboardPath() to private Keyboard.getKeyboardUrl().

Part-of: #16096
Replaces: #16132

@github-project-automation github-project-automation Bot moved this to Todo in Keyman Jun 26, 2026
@keymanapp-test-bot keymanapp-test-bot Bot added the user-test-missing User tests have not yet been defined for the PR label Jun 26, 2026
@keymanapp-test-bot

keymanapp-test-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

User Test Results

Test specification and instructions

ERROR: user tests have not yet been defined

Test Artifacts

  • Android
    • Keyman for Android apk - build : all tests passed (no artifacts on BuildLevel "build")
    • FirstVoices Keyboards for Android apk - build : all tests passed (no artifacts on BuildLevel "build")
    • FirstVoices Keyboards for Android apk (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
    • KeyboardHarness apk - build : all tests passed (no artifacts on BuildLevel "build")
    • Keyman for Android apk (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
    • KMSample1 apk - build : all tests passed (no artifacts on BuildLevel "build")
    • KMSample2 apk - build : all tests passed (no artifacts on BuildLevel "build")

This change moves to using `WebViewAssetLoader` for loading files from
the device instead of using file:// URLs. This fixes the blank keyboard
problem reported in #16096 for Android.

Also make `KMKeyboard.getKeyboardRoot()` private, and rename public
`Keyboard.getKeyboardPath()` to private `Keyboard.getKeyboardUrl()`.

Part-of: #16096
@ermshiperete ermshiperete force-pushed the fix/android/16096_blankKeyboard branch from b406759 to 64abd5b Compare June 26, 2026 18:02
@ermshiperete ermshiperete marked this pull request as ready for review June 26, 2026 18:10
@jahorton

Copy link
Copy Markdown
Contributor

Also this PR makes KMKeyboard.getKeyboardRoot() private, and renames public Keyboard.getKeyboardPath() to private Keyboard.getKeyboardUrl().

Note that KMKeyboard is a part of our public API for Keyman Engine for Android. That said, .getKeyboardRoot() was never published. It may be worth seeing if Scripture App Builder or Keyboard App Builder were using it.

https://help.keyman.com/developer/engine/android/current-version/KMKeyboard/

@jahorton jahorton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM aside from the one nit.

}

public String getKeyboardRoot() {
private String getKeyboardRoot() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should probably leave this unchanged; KMKeyboard is an engine API class.

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

Labels

android/app/ android/engine/ android/ fix user-test-missing User tests have not yet been defined for the PR

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants