Status Update
Comments
si...@google.com <si...@google.com> #2
Could you attach a screenshot of how it looks ?
si...@google.com <si...@google.com> #3
du...@gmail.com <du...@gmail.com> #4
I want to emphasize that this was a fairly large edittext (wrapped by a scrollView in a LinearLayoutCompat, which in turn was in a RelativeLayout fwiw) used as a text editor. It had just under 150K of normal plaintext in it and if I remember right, it had a slightly longer delay as opposed to when the ET was empty-- but don't quote me on that. It also has its own TextWatcher, but eliminating that completely made no difference-- the only complete fix I found was to stop the emojiCompat from starting in the first place and boom, instant fix with the performance I had before.
Strangely, typing INTO the document was EXTREMELY slow. But hitting the backspace was maybe 130% of normal speeds, as if adding to the document was requiring a lot of measurement or something but subtracting from it returned faster. Both were delayed, but hitting space bar a few times was noticeably slower than hitting backspace a few times. I thought somehow this might have to do with undo/redo, but eliminating that also didn't seem to affect anything
Other observations-- I hadn't done a build in a couple months where I had tested the EditText responsiveness, so I'm not sure when this became an issue. I am using Android Studio Chipmunk / 2021.2.1 Canary 7, Jan 5 build, on Linux. As mentioned, adding/removing emoji2 to the dependencies in build.gradle made no difference. I also tested with the Google IME as well as a 3rd party one just to make sure this wasn't some kind of delay in the keyboard. No difference, and typing with a physical keyboard into the emulator also had the issue.
Hope this is helpful.
du...@gmail.com <du...@gmail.com> #5
si...@google.com <si...@google.com> #6
Note: based on previous information about majority of time being spent in DynamicLayout$Watcher, and also what mentioned in
"Strangely, typing INTO the document was EXTREMELY slow. But hitting the backspace was maybe 130% of normal speeds"
It might be
si...@google.com <si...@google.com> #7
for your use case, very long edit text is not a surprise to have some issues with Spans. It is possibly more related to text having spans rather than the code in EmojiCompat.
I still suggest to turn off emojicompat for the EditText that contains the very large text only (rather than the whole app)
Description
forked from b/189737781#comment3 :
"This is a massive issue in 2022 w/Android 12. The edittext in question (actually a AppCompatMultiAutoCompleteTextView) is being used in a text editor app and is fairly large/full screen.
Any (soft) keyboard press is causing a 1 second delay before that character appears. Not just emojis, but ANY character typed to the screen has a HUGE processing delay.
Via the profiler, the problem is tracked to EmojiCompat.process-- it is consuming 491ms per KEYPRESS. androidText.dynamicLayout$ChangeWatcher.reflow is consuming most of this time.
Disabling all emoji input via filter instantly returns the edittext to a responsive usable state.
Please fix this quickly as it no doubt will affect any app that uses a larger edittext. I tried w/dependency on androidx.emoji2:emoji2:1.1.0-alpha01 in gradle.build and without."