Helium314 / HeliBoard

Customizable and privacy-conscious open-source keyboard
Apache License 2.0
2.47k stars 97 forks source link

Keyboard is opening slow when using in the webview with in the app #1137

Open ponnamkarthik opened 1 month ago

ponnamkarthik commented 1 month ago

Describe the bug I took the code and added a webview inside the app and when i try to input some thing inside the webview it taking too much time to open the keyboard and sometime it crashes with ANR

Video

https://github.com/user-attachments/assets/c947a5f1-d65e-41b5-aa05-ec73358d3b44

Logs

2024-10-03 18:01:25.538 31682-31682 InsetsController        helium314.keyboard.debug             D  show(ime(), fromIme=true)
2024-10-03 18:01:25.541 31682-31682 LatinIME                helium314.keyboard.debug             D  onInlineSuggestionsResponse called
2024-10-03 18:01:25.548 31682-31738 OpenGLRenderer          helium314.keyboard.debug             I  Davey! duration=2156ms; Flags=0, FrameTimelineVsyncId=46416817, IntendedVsync=230883361794231, Vsync=230885478455606, InputEventId=0, HandleInputStart=230885495061609, AnimationStart=230885495248796, PerformTraversalsStart=230885502956817, DrawStart=230885504999005, FrameDeadline=230883512182790, FrameInterval=230885494826036, FrameStartTime=16666625, SyncQueued=230885506170151, SyncStart=230885506738536, IssueDrawCommandsStart=230885506914734, SwapBuffers=230885509929578, FrameCompleted=230885519276713, DequeueBufferDuration=37969, QueueBufferDuration=556458, GpuCompleted=230885519276713, SwapBuffersCompleted=230885511198536, DisplayPresentTime=-70834868404857341, CommandSubmissionCompleted=230885509929578, 
2024-10-03 18:01:25.575 31682-31868 OpenGLRenderer          helium314.keyboard.debug             I  Davey! duration=2167ms; Flags=0, FrameTimelineVsyncId=46416817, IntendedVsync=230883361794231, Vsync=230885478455606, InputEventId=0, HandleInputStart=230885495061609, AnimationStart=230885495248796, PerformTraversalsStart=230885502956817, DrawStart=230885507494578, FrameDeadline=230883528850011, FrameInterval=230885494826036, FrameStartTime=16666625, SyncQueued=230885508308067, SyncStart=230885511279421, IssueDrawCommandsStart=230885511390203, SwapBuffers=230885514193380, FrameCompleted=230885532149786, DequeueBufferDuration=29063, QueueBufferDuration=428333, GpuCompleted=230885532149786, SwapBuffersCompleted=230885515581661, DisplayPresentTime=0, CommandSubmissionCompleted=230885514193380, 
2024-10-03 18:01:27.548 31682-31682 RemoteInputConnection   helium314.keyboard.debug             W  getTextBeforeCursor() didn't respond in 2000 msec.
2024-10-03 18:01:27.550 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Slow InputConnection: RELOAD_TEXT_CACHE took 2002 ms.
2024-10-03 18:01:27.550 31682-31682 RichInputConnection     helium314.keyboard.debug             E  Unable to connect to the editor to retrieve text.
2024-10-03 18:01:27.550 31682-31682 RichInputConnection     helium314.keyboard.debug             D  Will try to retrieve text later.
2024-10-03 18:01:27.579 31682-31682 Choreographer           helium314.keyboard.debug             I  Skipped 123 frames!  The application may be doing too much work on its main thread.
2024-10-03 18:01:27.675 31682-31868 OpenGLRenderer          helium314.keyboard.debug             I  Davey! duration=2122ms; Flags=0, FrameTimelineVsyncId=46417768, IntendedVsync=230885512956759, Vsync=230887564083603, InputEventId=-522155027, HandleInputStart=230887566335358, AnimationStart=230887568543431, PerformTraversalsStart=230887571975983, DrawStart=230887577783171, FrameDeadline=230885545122147, FrameInterval=230887565801817, FrameStartTime=16675828, SyncQueued=230887612074681, SyncStart=230887612502650, IssueDrawCommandsStart=230887613027806, SwapBuffers=230887625485358, FrameCompleted=230887636253535, DequeueBufferDuration=63906, QueueBufferDuration=799531, GpuCompleted=230887636253535, SwapBuffersCompleted=230887627207702, DisplayPresentTime=-70024390896044484, CommandSubmissionCompleted=230887625485358, 
2024-10-03 18:01:27.714 31682-31868 OpenGLRenderer          helium314.keyboard.debug             I  Davey! duration=2158ms; Flags=0, FrameTimelineVsyncId=46417768, IntendedVsync=230885512956759, Vsync=230887564083603, InputEventId=1276990308, HandleInputStart=230887566335358, AnimationStart=230887568543431, PerformTraversalsStart=230887571975983, DrawStart=230887634519785, FrameDeadline=230885561788772, FrameInterval=230887565801817, FrameStartTime=16675828, SyncQueued=230887636982181, SyncStart=230887638730462, IssueDrawCommandsStart=230887639087806, SwapBuffers=230887664044577, FrameCompleted=230887673535931, DequeueBufferDuration=45313, QueueBufferDuration=464584, GpuCompleted=230887673535931, SwapBuffersCompleted=230887665788796, DisplayPresentTime=0, CommandSubmissionCompleted=230887664044577, 
2024-10-03 18:01:29.660 31682-31682 RemoteInputConnection   helium314.keyboard.debug             W  getTextBeforeCursor() didn't respond in 2000 msec.
2024-10-03 18:01:29.662 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Slow InputConnection: RELOAD_TEXT_CACHE took 2002 ms.
2024-10-03 18:01:29.662 31682-31682 RichInputConnection     helium314.keyboard.debug             E  Unable to connect to the editor to retrieve text.
2024-10-03 18:01:29.664 31682-31682 RichInputConnection     helium314.keyboard.debug             D  Will try to retrieve text later.
2024-10-03 18:01:29.673 31682-31682 Choreographer           helium314.keyboard.debug             I  Skipped 124 frames!  The application may be doing too much work on its main thread.
2024-10-03 18:01:29.758 31682-31868 OpenGLRenderer          helium314.keyboard.debug             I  Davey! duration=2123ms; Flags=0, FrameTimelineVsyncId=46418841, IntendedVsync=230887578456698, Vsync=230889645105674, InputEventId=0, HandleInputStart=230889660705149, AnimationStart=230889667461295, PerformTraversalsStart=230889681069055, DrawStart=230889683543534, FrameDeadline=230887697481065, FrameInterval=230889659440878, FrameStartTime=16666524, SyncQueued=230889685025566, SyncStart=230889685888691, IssueDrawCommandsStart=230889686135201, SwapBuffers=230889692360930, FrameCompleted=230889702986034, DequeueBufferDuration=80729, QueueBufferDuration=847760, GpuCompleted=230889702986034, SwapBuffersCompleted=230889694643795, DisplayPresentTime=0, CommandSubmissionCompleted=230889692360930, 
2024-10-03 18:01:31.720 31682-31682 RemoteInputConnection   helium314.keyboard.debug             W  getTextBeforeCursor() didn't respond in 2000 msec.
2024-10-03 18:01:31.722 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Slow InputConnection: RELOAD_TEXT_CACHE took 2002 ms.
2024-10-03 18:01:31.723 31682-31682 RichInputConnection     helium314.keyboard.debug             E  Unable to connect to the editor to retrieve text.
2024-10-03 18:01:31.725 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Unable to connect to the editor. Setting caps mode without knowing text.
2024-10-03 18:01:33.769 31682-31682 RemoteInputConnection   helium314.keyboard.debug             W  getTextBeforeCursor() didn't respond in 2000 msec.
2024-10-03 18:01:33.770 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Slow InputConnection: RELOAD_TEXT_CACHE took 2002 ms.
2024-10-03 18:01:33.771 31682-31682 RichInputConnection     helium314.keyboard.debug             E  Unable to connect to the editor to retrieve text.
2024-10-03 18:01:33.771 31682-31682 RichInputConnection     helium314.keyboard.debug             D  Will try to retrieve text later.
2024-10-03 18:01:35.808 31682-31682 RemoteInputConnection   helium314.keyboard.debug             W  getTextBeforeCursor() didn't respond in 2000 msec.
2024-10-03 18:01:35.809 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Slow InputConnection: RELOAD_TEXT_CACHE took 2002 ms.
2024-10-03 18:01:35.810 31682-31682 RichInputConnection     helium314.keyboard.debug             E  Unable to connect to the editor to retrieve text.
2024-10-03 18:01:35.810 31682-31682 RichInputConnection     helium314.keyboard.debug             D  Will try to retrieve text later.
2024-10-03 18:01:35.813 31682-31682 Choreographer           helium314.keyboard.debug             I  Skipped 367 frames!  The application may be doing too much work on its main thread.
2024-10-03 18:01:35.882 31682-31868 OpenGLRenderer          helium314.keyboard.debug             I  Davey! duration=6175ms; Flags=0, FrameTimelineVsyncId=46420006, IntendedVsync=230889678494767, Vsync=230895795192384, InputEventId=-209950339, HandleInputStart=230895799801657, AnimationStart=230895807134313, PerformTraversalsStart=230895814519261, DrawStart=230895819466657, FrameDeadline=230889695161433, FrameInterval=230895799376188, FrameStartTime=16666751, SyncQueued=230895830967855, SyncStart=230895831326605, IssueDrawCommandsStart=230895831978636, SwapBuffers=230895840984834, FrameCompleted=230895854786240, DequeueBufferDuration=71146, QueueBufferDuration=955313, GpuCompleted=230895854786240, SwapBuffersCompleted=230895843487438, DisplayPresentTime=-69125406996142168, CommandSubmissionCompleted=230895840984834, 
2024-10-03 18:01:35.898 31682-31738 OpenGLRenderer          helium314.keyboard.debug             I  Davey! duration=6170ms; Flags=0, FrameTimelineVsyncId=46420006, IntendedVsync=230889678494767, Vsync=230895795192384, InputEventId=0, HandleInputStart=230895799801657, AnimationStart=230895807134313, PerformTraversalsStart=230895814519261, DrawStart=230895832445563, FrameDeadline=230889728438436, FrameInterval=230895799376188, FrameStartTime=16666751, SyncQueued=230895833744157, SyncStart=230895843652386, IssueDrawCommandsStart=230895843922230, SwapBuffers=230895854276553, FrameCompleted=230895858892751, DequeueBufferDuration=47656, QueueBufferDuration=767969, GpuCompleted=230895858892751, SwapBuffersCompleted=230895856112699, DisplayPresentTime=0, CommandSubmissionCompleted=230895854276553, 
2024-10-03 18:01:37.917 31682-31682 RemoteInputConnection   helium314.keyboard.debug             W  getTextBeforeCursor() didn't respond in 2000 msec.
2024-10-03 18:01:37.920 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Slow InputConnection: RELOAD_TEXT_CACHE took 2003 ms.
2024-10-03 18:01:37.920 31682-31682 RichInputConnection     helium314.keyboard.debug             E  Unable to connect to the editor to retrieve text.
2024-10-03 18:01:37.921 31682-31682 RichInputConnection     helium314.keyboard.debug             D  Will try to retrieve text later.
2024-10-03 18:01:39.937 31682-31682 RemoteInputConnection   helium314.keyboard.debug             W  getTextBeforeCursor() didn't respond in 2000 msec.
2024-10-03 18:01:39.938 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Slow InputConnection: RELOAD_TEXT_CACHE took 2003 ms.
2024-10-03 18:01:39.938 31682-31682 RichInputConnection     helium314.keyboard.debug             E  Unable to connect to the editor to retrieve text.
2024-10-03 18:01:39.939 31682-31682 RichInputConnection     helium314.keyboard.debug             D  Will try to retrieve text later.
2024-10-03 18:01:41.525 31682-31688 .keyboard.debug         helium314.keyboard.debug             I  Thread[4,tid=31688,WaitingInMainSignalCatcherLoop,Thread*=0x6ed661a2c0,peer=0x13500000,"Signal Catcher"]: reacting to signal 3
2024-10-03 18:01:41.529 31682-31688 .keyboard.debug         helium314.keyboard.debug             I  
2024-10-03 18:01:41.940 31682-31682 RemoteInputConnection   helium314.keyboard.debug             W  getTextBeforeCursor() didn't respond in 2000 msec.
2024-10-03 18:01:41.941 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Slow InputConnection: RELOAD_TEXT_CACHE took 2002 ms.
2024-10-03 18:01:41.941 31682-31682 RichInputConnection     helium314.keyboard.debug             E  Unable to connect to the editor to retrieve text.
2024-10-03 18:01:41.942 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Unable to connect to the editor. Setting caps mode without knowing text.
2024-10-03 18:01:41.948 31682-31682 Choreographer           helium314.keyboard.debug             I  Skipped 367 frames!  The application may be doing too much work on its main thread.
2024-10-03 18:01:42.017 31682-31868 OpenGLRenderer          helium314.keyboard.debug             I  Davey! duration=6161ms; Flags=0, FrameTimelineVsyncId=46423130, IntendedVsync=230895811852805, Vsync=230901928546385, InputEventId=-454233916, HandleInputStart=230901935312228, AnimationStart=230901939330665, PerformTraversalsStart=230901942698165, DrawStart=230901956203478, FrameDeadline=230895878526054, FrameInterval=230901933720144, FrameStartTime=16666740, SyncQueued=230901960857280, SyncStart=230901961121394, IssueDrawCommandsStart=230901961501655, SwapBuffers=230901964632801, FrameCompleted=230901973599207, DequeueBufferDuration=43334, QueueBufferDuration=630520, GpuCompleted=230901973599207, SwapBuffersCompleted=230901966000821, DisplayPresentTime=-68055796930431669, CommandSubmissionCompleted=230901964632801, 
2024-10-03 18:01:42.017 31682-31868 OpenGLRenderer          helium314.keyboard.debug             I  Davey! duration=6162ms; Flags=0, FrameTimelineVsyncId=46423130, IntendedVsync=230895811852805, Vsync=230901928546385, InputEventId=0, HandleInputStart=230901935312228, AnimationStart=230901939330665, PerformTraversalsStart=230901942698165, DrawStart=230901961838426, FrameDeadline=230895878526054, FrameInterval=230901933720144, FrameStartTime=16666740, SyncQueued=230901962748738, SyncStart=230901966684884, IssueDrawCommandsStart=230901966856551, SwapBuffers=230901971138530, FrameCompleted=230901978593686, DequeueBufferDuration=40209, QueueBufferDuration=562187, GpuCompleted=230901978593686, SwapBuffersCompleted=230901972596238, DisplayPresentTime=0, CommandSubmissionCompleted=230901971138530, 
2024-10-03 18:01:42.221 31682-31688 .keyboard.debug         helium314.keyboard.debug             I  Wrote stack traces to tombstoned
2024-10-03 18:01:43.984 31682-31682 RemoteInputConnection   helium314.keyboard.debug             W  getTextBeforeCursor() didn't respond in 2000 msec.
2024-10-03 18:01:43.985 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Slow InputConnection: RELOAD_TEXT_CACHE took 2002 ms.
2024-10-03 18:01:43.985 31682-31682 RichInputConnection     helium314.keyboard.debug             E  Unable to connect to the editor to retrieve text.
2024-10-03 18:01:43.986 31682-31682 RichInputConnection     helium314.keyboard.debug             D  Will try to retrieve text later.
2024-10-03 18:01:45.987 31682-31682 RemoteInputConnection   helium314.keyboard.debug             W  getTextBeforeCursor() didn't respond in 2000 msec.
2024-10-03 18:01:45.988 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Slow InputConnection: GET_TEXT_BEFORE_CURSOR took 2002 ms.
2024-10-03 18:01:47.989 31682-31682 RemoteInputConnection   helium314.keyboard.debug             W  getSelectedText() didn't respond in 2000 msec.
2024-10-03 18:01:49.991 31682-31682 RemoteInputConnection   helium314.keyboard.debug             W  getTextBeforeCursor() didn't respond in 2000 msec.
2024-10-03 18:01:49.993 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Slow InputConnection: RELOAD_TEXT_CACHE took 2002 ms.
2024-10-03 18:01:49.993 31682-31682 RichInputConnection     helium314.keyboard.debug             E  Unable to connect to the editor to retrieve text.
2024-10-03 18:01:49.993 31682-31682 RichInputConnection     helium314.keyboard.debug             W  Unable to connect to the editor. Setting caps mode without knowing text.
Helium314 commented 1 month ago

Maybe some issue with editor and input connection being on the same thread. But certainly not a bug in the app as no version includes a webview.

ghoridharmik commented 1 month ago

getSelectedText() didn't respond in 2000 msec. requestCursorUpdates() didn't respond in 2000 msec. getTextBeforeCursor() didn't respond in 2000 msec. getTextBeforeCursor() didn't respond in 2000 msec.

These are the logs before it crashed Or ANR. @Helium314 Can you please look into these and help us?