什么是blockWebkitDraw的含义及如何解决?如何解决、含义、blockWebkitDraw

2023-09-05 02:03:14 作者:共话桑麻

我使用的WebView包装的Andr​​oid应用程序,它需要渲染HTML5的画布。它的工作原理完全可以在我所有的设备,除了一个。我的Galaxy S4(4.2.2)闪烁画布,那么它很快变成灰色。这里是logcat的消息,它的产生:

I'm wrapping an Android app using a WebView and it requires rendering an HTML5 canvas. It works perfectly on all my devices, except for one. My Galaxy S4 (4.2.2) is flashing the canvas, then it quickly turns grey. Here is the logcat message it's producing:

D / GestureDetector(20071):表面触摸事件] mSweepDown假,   mLRSDCnt:-1 mTouchCnt:7 mFalseSizeCnt:0

D/GestureDetector(20071): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 7 mFalseSizeCnt:0

V / WebViewInputDispatcher(20071):blockWebkitDraw

V/WebViewInputDispatcher(20071): blockWebkitDraw

V / WebViewInputDispatcher(20071):blockWebkitDraw lockedfalse

V/WebViewInputDispatcher(20071): blockWebkitDraw lockedfalse

D /的WebView(20071):blockWebkitViewMessage = FALSE

D/webview(20071): blockWebkitViewMessage= false

我点击一个按钮,然后在画布上应该呈现。这就是为什么第一个日志项目是一个表面触摸事件。它适用于我的S4,当我用ping通我的应用程序的WebKit浏览器直接,但包裹在它自己或使用科尔多瓦是给我的错误。我已经添加了两个截图,进一步显示问题。第一是正确呈现,第二个是该问题。

I click on a button, then the canvas is supposed to render. That is why the first log item is for a surface touch event. It works on my S4 when I ping my app using the webkit browser directly, but when wrapping it myself or using Cordova is gives me that error. I've added two screenshots to further display the issue. The first is rendered correctly and the second is the problem.

安卓2.3.6:

安卓4.2.2:

所以,回到我的问题。这是怎么回事与此消息?是否有人对如何让它正确地呈现在画布上有什么建议?

So back to my question. What's going on with this message? Does anybody have any suggestions on how to have it properly render the canvas?

推荐答案

我可以通过我的最低SDK版本在Android清单文件设置为14来解决这个问题:

I was able to fix the problem by setting my minimum sdk version in the android manifest file to 14:

<uses-sdk android:minSdkVersion="14" />

在第14版,邮件仍然会出现在日志中,但在触摸事件进行处理。当我设置的minSdkVersion回来,触摸事件未被处理。关闭清单中的硬件加速,以及由各种CSS的webkit的风格,并没有帮助。只有的minSdkVersion设置固定为我。

At version 14, the messages still appear in the log, but the touch events are processed. When I set the minSdkVersion back, the touch events are not processed. Turning off hardware acceleration in the manifest, as well as by various CSS webkit styles, did not help. Only the minSdkVersion setting fixed it for me.

不知何故,对Galaxy Tab的,对于旧版本的SDK支持出现问题与JavaScript的触摸事件的处理,并blockWebkitDraw保持真实而触摸的举动正在发生的事情。这$ P $自收到touchmove事件和执行抽奖pvents我的画布code。当我设置的SDK版本为14,blockWebkitDraw被设置为当触摸事件触发正确的,但它是没有设置的触摸处理后,与画布code绘制被调用。

Somehow, on the Galaxy Tab, the SDK support for older versions causes problems with the javascript touch event processing, and blockWebkitDraw stays true while a touch move is happening. This prevents my canvas code from receiving the touchmove events and executing the draw. When I set the SDK version to 14, blockWebkitDraw gets set to true when a touch event fires, but it is unset after the touch is processed, and the canvas code to draw gets called.