WebView java.lang.SecurityException: No permission

2020-06-02 15:10发布

问题:

I have an application that uses multiple WebViews. Nowhere do I set the priority of the render thread through the WebSettings though I still get the exception below.

So far it only seems to happen on android 4.0.4, which I haven't found the source code for.

Anyone run into this and/or knows a solution? Thanks!

java.lang.SecurityException: No permission to modify given thread
at android.os.Process.setThreadPriority(Native Method)
at android.webkit.WebViewCore$WebCoreThread$1.handleMessage(WebViewCore.java:712)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:789)
at java.lang.Thread.run(Thread.java:856)

回答1:

It's cyanogen's fault. https://github.com/CyanogenMod/android_frameworks_base/commit/b963f3c0c64560bcdb1596dd85fe9b0dad6d78c5#L1R712

I have a pile of crash reports on this issue, all from 4.0.4 on many different devices, all of them likely running some form of CM9 (most don't have official ICS releases yet).

I don't have time to yell at them, so hopefully someone else can bring it up in their bug tracker.