Open sentry-io[bot] opened 7 months ago
In case it somehow ends up mattering, I was emulating a Nexus 5 set to API 32 via Android Studio. The "force-kill" and "restart" operations were triggered by terminating the debugging session via the IDE and starting a new one via the IDE, respectively.
Triaged to 18.0
Decided to investigate this a bit more due to its relationship with #11550; when the repro triggers, the underlying keyboard does, in fact, update - at least, within the Settings menu.
While there was quite the delay in the download completing for the keyboard update, the host page did still reset and reload with the updated version. I verified this via WebView inspection and checking the KBVER
property on the loaded keyboard, both before and after. It didn't appear to take effect at first... simply because of the download lag. (I left the inspector up, and when I came back to it, the console logs had cleared due to the reset. Sure enough, the keyboard was updated as well.)
If I stay on the language-specific settings screen, the Sentry event does not trigger. Granted, I didn't see the finalizing notification, but that's because I didn't want to keep my eyes glued to the screen that long.
As best as I can tell, the cause of the error is likely here:
There are exactly two spots that call the checkForResourceUpdates
method, which requires a Context
be passed in, and that is one of them. The other one forwards a Context
parameter corresponding either to MainActivity
or to SystemKeyboard
- either of which will last for the app's lifetime. LanguagesSettingsActivity
, though... that one only lasts as long as a user is within the appropriate area of the Settings menu.
Why is checkForResourceUpdates
significant?
That field - currentContext
- is only set here. Also note the isContextAvailable
function:
For it to return false
requires that currentContext
be set and be in that "finishing" state. Exiting fully from the Settings menu would certainly trigger that if currentContext
was left pointing to an instance of LanguagesSettingsActivity
.
Retriaging to 19.0 per https://github.com/keymanapp/keyman/issues/11550#issuecomment-2148853989.
Sentry Issue: KEYMAN-ANDROID-4AJ
@jahorton here. I ran into this while testing #10017 with a version-edited .kmp. I can verify that the following line was reached via debugger when reproducing it:
https://github.com/keymanapp/keyman/blob/864f37884449bac22aff642c0647b61051847898/android/KMEA/app/src/main/java/com/keyman/engine/logic/ResourcesUpdateTool.java#L524
Repro (as done via Android Studio device emulation):
The download process took surprising long to complete when I did this - I had ample time to "exit back" - and my goal for testing #10017 was to verify that the host-page would reset... which is best done by actually having the keyboard host-page active and viewable. (I actually had an 'inspector' open via Chrome to validate that the console was reset... which is suspended unless the host-page is active.) I think it took somewhere between 30 sec to 1 minute for the update's download to complete? Just in case that's relevant.