Surface::setbuffersDimensions Log being spammed

天大地大妈咪最大 提交于 2019-12-04 02:47:14

问题


I have built an Android app that is working fine and as expected with a tablet: Acer. 7-inch API 21.

I recently got a new tablet: Acer. 10-inch API 22.

Now I am getting my logs spammed with this line.

04-12 18:23:27.371 8776-9082/com.callbell.callbell D/Surface: Surface::setBuffersDimensions(this=0x7f9aa44000,w=800,h=1280)

and the screen will freeze and go blank at random intervals. I have not seen any errors in the log and the only reference I can find to this log line is here

https://android.googlesource.com/platform/frameworks/native/+/fe94bd262bc0a33d709aee8fb70c1369656b479b/libs/gui/Surface.cpp

UPDATE I've tried this on a few devices with varying success.

NO ISSUES:

Samsung Galaxy Tab 7"

Samsung Galaxy Tab 10"

Acer Iconia 8"

ISSUES:

Acer Iconia 10"


回答1:


These log come when we have EditText with cursor, And that cursor blink is responsible to redraw screen.

Surface::setBuffersDimensions(this=0x7f4ccc7c00,w=1080,h=1920)
D/OpenGLRenderer: WorkerThread 0x7f7c07f000 running

When I did

android:cursorVisible="false"

these logs were gone.

So when studio screen become spam with these logs, Its an alert for developer to check UI draw pattern.




回答2:


This log means that something on your screen is being redrawn.
It is shown only on few devices, but whatever the device you are using, you can enable 'hardware layers updates' or 'gpu view updates' in developer options and you'll see flashed zone, which is being redrawn.
Moreover, if the issue exists on one device, it's likely that it exists on others too.




回答3:


If anyone else finds this issue, make sure that you don't have something like a ProgressBar or so that you're not stopping from rendering after the WebView has finished loading. In Xamarin.Android, I had to override OnPageFinished, from the WebViewClient, and set progressBar.Visibility = ViewStates.Gone;. There's also a link in there to a GitHub repo (not mine) that has some other WebViewClient override implementations:

        public class MyWebViewClient : WebViewClient
    {
        public override bool ShouldOverrideUrlLoading(WebView view, string url)
        {
            view.LoadUrl(url);
            return false;
        }

        //More overrides: https://github.com/xamarin/monodroid-samples/blob/master/MonoIO/UI/MapFragment.cs
        public override void OnPageFinished(WebView view, string url)
        {
            base.OnPageFinished(view, url);
            progressBar.Visibility = ViewStates.Gone;
            view.Visibility = ViewStates.Visible;
        }

    }


来源:https://stackoverflow.com/questions/36586416/surfacesetbuffersdimensions-log-being-spammed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!