keymanapp / keymanapp/keyman

bug(android): error when background update completes but cannot notify

Open
#11,550 3 comments 0 reactions 1 assignee Claimed by @jahorton View on GitHub
android/ bug
Dominant language
Pascal
Stars
534
Forks
143
Avg merge
2d 10h
Merged PRs (30d)
113

Description

Sentry Issue: [KEYMAN-ANDROID-3Q8](https://keyman.sentry.io/issues/4362830460/?referrer=github_integration)

```
onLexicalModelInstalled where context is null.
```

@jahorton here.

Based on my analysis of where this error is generated in the overall app/keyboard control flow... it appears that this is called when a lexical model is updated, but the `context` corresponding to the entity that requested the update is no longer valid.

The logging line in question was originally added in #3499... to investigate errors we saw before we started using Sentry. Whatever those errors were... is likely now lost to history, though.

My interpretation of this scenario is that we'd previously triggered a background update, which has now succeeded... but only after the host's lifetime is completed.

References:

https://github.com/keymanapp/keyman/blob/b068f94537e6bf8703068143473aec7d30ff584c/android/KMEA/app/src/main/java/com/keyman/engine/logic/ResourcesUpdateTool.java#L446-L449

Note the `.isFinishing` check:

https://developer.android.com/reference/android/app/Activity#isFinishing()

https://stackoverflow.com/q/10847526
- "What is Activity.finish() method doing exactly"

> I know Activity.finish() method calls somewhere in the way to Activity.onDestroy(), and also removing the activity from stack [...]

From the Android docs link above:
> **`isFinishing`**
> Check to see whether this activity is in the process of finishing, either because you called finish() on it or someone else has requested that it finished. [...]

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.