keymanapp / keymanapp/keyman

bug(android): bad order of operations for updating keyboard state

Open
#11,161 0 comments 0 reactions 0 assignees View on GitHub
android/ bug low-priority
Dominant language
Pascal
Stars
534
Forks
143
Avg merge
2d 10h
Merged PRs (30d)
113

Description

While collecting data via profiling for a different task, I ran into proof of an internal race condition:

[Chrome performance profile (.json)](https://github.com/keymanapp/keyman/files/14860632/sus.android.keyboard.swap.json)

Note the timestamps in the following images:

![image](https://github.com/keymanapp/keyman/assets/25213402/28cc2aeb-1ab4-4fa8-8b7c-c60d1e52aae2)

Web has been told to load a keyboard; this, of course, requires fetching it.

The usual _post-keyboard load_ update:

![image](https://github.com/keymanapp/keyman/assets/25213402/207aeaa4-ef12-4440-aeb1-f07c25ba4ec2)

The keyboard script _actually_ loading, being processed, and moving toward display of the OSK:

![image](https://github.com/keymanapp/keyman/assets/25213402/4a779179-7c89-4a1a-8606-31d256021ed4)

Note: _**those last two steps are out of order!**_

Fortunately... we do a context-reset anyway once the keyboard load is complete, so I _believe_ that, at present, this has no net effect. (So, I've marked it as low-priority for now.) The fact that this can occur does appear significant though, so I wanted to note it in case it matters at some point in the future. I'd have assumed that this ordering would never occur.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.