Dimezis / BlurView

Dynamic iOS-like blur of underlying Views for Android
Apache License 2.0
3.48k stars 331 forks source link

eightbitlab.com.blurview.RenderScriptBlur.blur ANR triggered by main thread waiting for too long #206

Closed jasondem closed 3 months ago

jasondem commented 1 year ago

Please include: 1) Library version version-2.0.3

2) Device and OS version all devices OS version are android 11,such as Vivo 1901,Galaxy A50,Realme C12,CPH2239 3) Detailed steps to reproduce the issue I don‘t konw how to reproduce it 4) XML layout and code for BlurView setup

5) Stacktrace in case of a crash image

Dimezis commented 1 year ago

Provide the details required in the bug report. There's not much I can do without steps to reproduce

jasondem commented 1 year ago

It is a bottom navigationBar, I use BulrView to achieve the bottom navigation bar frosted-glass effect, anr place in 'RenderScriptBlur.blur', is frosted-glass rendering placed in other threads can solve this problem?

jasondem commented 1 year ago

main (native):tid=1 systid=19015

00 pc 0x7550c libc.so (syscall + 28)

01 pc 0x1af800 libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*) + 148)

02 pc 0x669eb0 libart.so (art::GoToRunnable(art::Thread*) + 460)

03 pc 0x669ca0 libart.so (art::JniMethodEnd(unsigned int, art::Thread*) + 28)

   at android.renderscript.RenderScript.rsnScriptSetVarObj(Native method)
   at android.renderscript.RenderScript.nScriptSetVarObj(RenderScript.java:832)
   at android.renderscript.Script.setVar(Script.java:438)
   at android.renderscript.ScriptIntrinsicBlur.setInput(ScriptIntrinsicBlur.java:70)
   at eightbitlab.com.blurview.RenderScriptBlur.blur(RenderScriptBlur.java:69)
   at eightbitlab.com.blurview.PreDrawBlurController.blurAndSave(PreDrawBlurController.java:172)
   at eightbitlab.com.blurview.PreDrawBlurController.updateBlur(PreDrawBlurController.java:122)
   at eightbitlab.com.blurview.PreDrawBlurController$1.onPreDraw(PreDrawBlurController.java:50)
   at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1093)
   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3451)
   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2257)
   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8796)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1161)
   at android.view.Choreographer.doCallbacks(Choreographer.java:983)
   at android.view.Choreographer.doFrame(Choreographer.java:908)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1146)
   at android.os.Handler.handleCallback(Handler.java:938)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:263)
   at android.app.ActivityThread.main(ActivityThread.java:8292)
   at java.lang.reflect.Method.invoke(Native method)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1006)
Dimezis commented 1 year ago

I don't think it's BlurView's problem. Something is holding that lock libart waits on (WaitHoldingLocks). Most likely it's just an unlucky coincidence that the BlurView happens to execute the blur when the lock is busy, and the root cause is elsewhere.

jasondem commented 1 year ago

Thank you. I'll find out if it's caused by other places.