fix: prevent TransactionTooLargeException when attaching a file while replying to a message with a large HTML quote#11263
Open
mvanhorn wants to merge 1 commit into
Conversation
… replying to a message with a large HTML quote
2 tasks
Contributor
|
Missing report label. Set exactly one of: |
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.
Contribution Summary
Linked Issue/Ticket: Fixes #9425
Description
In
QuotedMessagePresenter.onSaveInstanceStatethe offending line isoutState.putSerializable(STATE_KEY_HTML_QUOTE, quotedHtmlContent). Guard this put by the character length of the quoted content (quotedHtmlContent.getQuotedContent()): only persist the HTML quote into the saved-stateBundlewhen it is below a safe threshold well under the Binder limit (e.g. a ~256 KB / ~262144-char cap defined as a constant), and skip the put when it is larger. This eliminates the oversized parcel and therefore the crash. To keep the size check unit-testable without standing up the full presenter (whose constructor pulls DI singletons and aMessageCompose/view), extract the decision into a small pure helper (e.g. a package-visible staticshouldPersistQuotedHtml(InsertableHtmlContent, int maxChars)/ size computation) thatonSaveInstanceStatecalls.onRestoreInstanceStatealready null-checksquotedHtmlContent, so when the quote was skipped the composer degrades gracefully rather than crashing: the user's typed text (saved separately by theEditText) is preserved, and only the rarely-hit "process killed while the picker is open, then recreated" path loses the re-displayable quote - an acceptable trade versus a guaranteed crash on every attach.MessageCompose.javais the caller ofonSaveInstanceStatebut requires no change, so it is intentionally excluded from the scope list.Screen Shots
N/A - no UI change; the fix guards saved-state serialization of the quoted-HTML in
QuotedMessagePresenter.AI Disclosure
Select one of the following (mandatory)
Contribution Checklist