-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement repeat filtering logic in Android Embedder #17509
Conversation
cc @jason-simmons Ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// Used to store the last-sent values via updateEditingState to the framework. | ||
// These are then compared against to prevent redundant messages with the same | ||
// data before any valid operations were made to the contents. | ||
private int mPreviousSelectionStart; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider moving the selection start/end, composing start/end, and text fields into a class. updateEditingState
would construct an instance of the class from the mEditable
and call its equals
method to check whether it matches the previous instance.
LUCI is actually green. Merging. |
There is a longstanding problem where some keyboards, via calls to endBatchEdit(), inadvertently send multiple copies of the same editing state to the framework. This has caused many issues that stem from the framework treating these repeat invocations as new instances of data or new keypresses.
In this PR, I add filtering to prevent the embedder from sending any state more than once unless it is marked as dirty via making any change to the state. This ensures that only valid changes to the state are sent to the framework.
The extra calls to
updateEdtingState()
may be removed for any override that calls the super version of itself since the default android implementation all include calls toendBatchEdit()
which includes a gated call toupdateEditingState
as needed.Paired with flutter/flutter#53974 to resolve b/152733348