android.view.Surface - OutOfResourcesException [英] android.view.Surface - OutOfResourcesException

查看:2499
本文介绍了android.view.Surface - OutOfResourcesException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这种奇怪的错误,并没有发现任何有关可能解决的办法。这个问题始终围绕有点玩我的应用程序后,随机出现。该应用程序完美运行几乎所有设备。还是关于此问题是present运行CM 7.1.0,我知道,很多用户CM7被抱怨类似的问题。设备之一

不幸的是,我有一些网友认为曾与应用程序相同的问题,但如果他们使用CM7与否我不知道。由于我无法重现相同的光盘上的其他应用程序这个错误就必须与别的东西。

,因为它出现之前完全随机的,所以复制源$ C ​​$ C不会是没有意义的,我说。这里的日志而是希望有人已经有同样的问题,可以帮助我。谢谢你。

  msm7k.gralloc(1306):页头MMAP(FD = 150,大小= 614400,PROT = 3)失败(再试)
msm7k.gralloc(1306):gralloc失败ERR =再试一次
GraphicBufferAllocator(1306):页头(320,480,1,00000033,...)失败-11​​(再试)
GraphicBufferAllocator(1306):分配的缓冲区:
GraphicBufferAllocator(1306):0x20a8d0:300.00昆明植物研究所| 320(320)×480 | 4 | 0x00000133
GraphicBufferAllocator(1306):0x20c110:531.25昆明植物研究所| 320(320)×425 | 1 | 0x00000133
GraphicBufferAllocator(1306):0x292db0:31.25昆明植物研究所| 320(320)×25 | 1 | 0x00000133
GraphicBufferAllocator(1306):0x2995​​68:300.00昆明植物研究所| 320(320)×480 | 4 | 0x00000133
GraphicBufferAllocator(1306):0x4a2288:331.25昆明植物研究所| 320(320)×265 | 1 | 0x00000133
GraphicBufferAllocator(1306):0x4b2518:31.25昆明植物研究所| 320(320)×25 | 1 | 0x00000133
GraphicBufferAllocator(1306):总分配:1525.00 KB
SurfaceFlinger的(1306):层:: requestBuffer(此= 0x3a7618),指数= 0,W = 320,H = 480失败(再试)
面(7024):表面(同一性= 224)requestBuffer(0,0,0,0,00000033)的返回一个缓冲器为空的手柄
表面(7024):getBufferLocked(0,0,0,0,00000033),失败(内存不足)
表面(7024):dequeueBuffer失败(内存不足)
的ViewRoot(7024):OutOfResourcesException锁定面
的ViewRoot(7024):android.view.Surface $ OutOfResourcesException
的ViewRoot(7024):在android.view.Surface.lockCanvasNative(本机方法)
的ViewRoot(7024):在android.view.Surface.lockCanvas(Surface.java:314)
的ViewRoot(7024):在android.view.ViewRoot.draw(ViewRoot.java:1461)
的ViewRoot(7024):在android.view.ViewRoot.performTraversals(ViewRoot.java:1263)
的ViewRoot(7024):在android.view.ViewRoot.handleMessage(ViewRoot.java:1865)
的ViewRoot(7024):在android.os.Handler.dispatchMessage(Handler.java:99)
的ViewRoot(7024):在android.os.Looper.loop(Looper.java:130)
的ViewRoot(7024):在android.app.ActivityThread.main(ActivityThread.java:3835)
的ViewRoot(7024):在java.lang.reflect.Method.invokeNative(本机方法)
的ViewRoot(7024):在java.lang.reflect.Method.invoke(Method.java:507)
的ViewRoot(7024):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:847)
的ViewRoot(7024):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
的ViewRoot(7024):在dalvik.system.NativeStart.main(本机方法)


解决方案

长时间拉着我的git犯我终于找到一个没有了这个问题之后。由于应用程序我正在显示在屏幕上的敏感数据,我试图改变显示为最近的应用程序一节中的缩略图图像。为了实现这一点,我被设置安全标记到窗口:

http://developer.android.com/reference/安卓/浏览/ Window.html#setFlags(INT ,INT)
<一href=\"http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SECURE\" rel=\"nofollow\">http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SECURE

原来,这是导致出现异常,而且表现出了黑屏的问题。我已经删除后,一切工作就好了。希望这个提示将帮助面临同样问题的其他开发者。

I have this strange bug, and found nothing about a possible solution to it. The problem always appears randomly after playing around a bit with my app. The app runs perfectly on almost all devices. Still one of the devices on which this issue is present is running CM 7.1.0 and I know that a lot of CM7 users were complaining about similar problems.

Unfortunately I have some users that had the same issue with the app, but I don't know if they were using CM7 or not. Since I wasn't able to reproduce this error in other apps on the same ROM it must be related to something else.

As I've said before it appears totally random, so copying the source code doesn't makes no sense. Here's the log instead, hopefully someone already had the same problem and can help me out. Thanks.

msm7k.gralloc(1306): alloc mmap(fd=150, size=614400, prot=3) failed (Try again)
msm7k.gralloc(1306): gralloc failed err=Try again
GraphicBufferAllocator(1306): alloc(320, 480, 1, 00000033, ...) failed -11 (Try again)
GraphicBufferAllocator(1306): Allocated buffers:
GraphicBufferAllocator(1306):   0x20a8d0:  300.00 KiB |  320 ( 320) x  480 |  4 | 0x00000133
GraphicBufferAllocator(1306):   0x20c110:  531.25 KiB |  320 ( 320) x  425 |  1 | 0x00000133
GraphicBufferAllocator(1306):   0x292db0:   31.25 KiB |  320 ( 320) x   25 |  1 | 0x00000133
GraphicBufferAllocator(1306):   0x299568:  300.00 KiB |  320 ( 320) x  480 |  4 | 0x00000133
GraphicBufferAllocator(1306):   0x4a2288:  331.25 KiB |  320 ( 320) x  265 |  1 | 0x00000133
GraphicBufferAllocator(1306):   0x4b2518:   31.25 KiB |  320 ( 320) x   25 |  1 | 0x00000133
GraphicBufferAllocator(1306): Total allocated: 1525.00 KB
SurfaceFlinger(1306): Layer::requestBuffer(this=0x3a7618), index=0, w=320, h=480 failed (Try again)
Surface(7024): Surface (identity=224) requestBuffer(0, 0, 0, 0, 00000033) returned a buffer with a null handle
Surface(7024): getBufferLocked(0, 0, 0, 0, 00000033) failed (Out of memory)
Surface(7024): dequeueBuffer failed (Out of memory)
ViewRoot(7024): OutOfResourcesException locking surface
ViewRoot(7024): android.view.Surface$OutOfResourcesException
ViewRoot(7024):     at android.view.Surface.lockCanvasNative(Native Method)
ViewRoot(7024):     at android.view.Surface.lockCanvas(Surface.java:314)
ViewRoot(7024):     at android.view.ViewRoot.draw(ViewRoot.java:1461)
ViewRoot(7024):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1263)
ViewRoot(7024):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1865)
ViewRoot(7024):     at android.os.Handler.dispatchMessage(Handler.java:99)
ViewRoot(7024):     at android.os.Looper.loop(Looper.java:130)
ViewRoot(7024):     at android.app.ActivityThread.main(ActivityThread.java:3835)
ViewRoot(7024):     at java.lang.reflect.Method.invokeNative(Native Method)
ViewRoot(7024):     at java.lang.reflect.Method.invoke(Method.java:507)
ViewRoot(7024):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
ViewRoot(7024):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
ViewRoot(7024):     at dalvik.system.NativeStart.main(Native Method)

解决方案

After long hours of pulling my git commits I've finally found one that didn't had this problem. Since the app I'm working on displays sensitive data on the screen, I was trying to change the image displayed as the thumbnail in the "Recent Apps" section. In order to achieve this I was setting the secure flag to the window:

http://developer.android.com/reference/android/view/Window.html#setFlags(int, int) http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SECURE

Turns out that this was the problem that caused the exception and the black screen that was shown. After I've removed it, everything was working just fine. Hopefully this tip will help other devs facing the same problem.

这篇关于android.view.Surface - OutOfResourcesException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆