Fix MalformedJsonException crash on requestPermission action#105
Open
sprinter814 wants to merge 2 commits into
Open
Fix MalformedJsonException crash on requestPermission action#105sprinter814 wants to merge 2 commits into
sprinter814 wants to merge 2 commits into
Conversation
Added requestPermission method to handle permission requests for AnkiConnect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was hitting this exact crash on an Onyx Boox Go 6 (Android 11) —
reportTopResumedActivityChangedfollowed by the app dying, triggered every time the Anki plugin tried to show a status pop-up (both with a direct AnkiDroid connection and with an AnkiConnect URL configured).In my case it turned out the root cause was upstream: AnkiConnect Android (the AnkiConnectAndroid app, KamWithK/AnkiconnectAndroid) doesn't implement the
requestPermissionaction thatanki.koplugin'sis_running()check sends, so it returns a malformed (non-JSON) response. The plugin choking on that response is what triggered the pop-up that then crashed KOReader on this device.I tested on KOReader 2024.11 (where this was 100% reproducible) and then upgraded to the latest release, 2026.03 ("Snowflake"), keeping the same settings/profile. After fixing the AnkiConnect Android side (PR here: KamWithK/AnkiconnectAndroid — link to follow once merged/opened), the connection check succeeds and notes are added without any crash on 2026.03 on this same device.
I can't be 100% sure whether the underlying Adreno/SIGSEGV crash itself was separately fixed somewhere between 2024.11 and 2026.03, or whether avoiding the malformed-JSON error response was enough to avoid hitting the crashing code path at all in my case. But for anyone else on a Boox device hitting this: it's worth checking whether your AnkiConnect server is actually responding correctly to
requestPermissionfirst, since a broken response there reliably reproduces the crash for me on both KOReader versions.Happy to provide more logs/device details if useful.