Android ANR SurfaceView

时间:2012-04-05 10:10:42

标签: android surfaceview

如果我从正在运行的Activity启动一个新的Activity,我会继续得到ANRs 有时 有一个SurfaceView。有谁知道这个锁是什么?我使用android支持包 使用片段,我的表面视图是一个片段。

----- pid 5281 at 2012-04-05 10:59:42 -----
Cmd line: com.customlbs.android

DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0 hwl=0 hwll=0)
"main" prio=5 tid=1 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x400281b8 self=0xd088
  | sysTid=5281 nice=0 sched=0/0 cgrp=default handle=-1345006464
  | schedstat=( 594287586 502197465 969 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x40028250> (a java.lang.VMThread)
  at java.lang.Thread.parkFor(Thread.java:1424)
  at java.lang.LangAccessImpl.parkFor(LangAccessImpl.java:48)
  at sun.misc.Unsafe.park(Unsafe.java:337)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:808)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:841)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1171)
  at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:185)
  at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:261)
  at android.view.SurfaceView.updateWindow(SurfaceView.java:506)
  at android.view.SurfaceView.updateWindow(SurfaceView.java:407)
  at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:217)
  at android.view.View.dispatchWindowVisibilityChanged(View.java:4080)
  at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:720)
  at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:720)
  at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:720)
  at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:720)
  at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:720)
  at android.view.ViewRoot.performTraversals(ViewRoot.java:790)
  at android.view.ViewRoot.handleMessage(ViewRoot.java:1868)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:130)
  at android.app.ActivityThread.main(ActivityThread.java:3691)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:507)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
  at dalvik.system.NativeStart.main(Native Method)

"Binder Thread #4" prio=5 tid=21 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40592610 self=0x1c80a8
  | sysTid=5357 nice=0 sched=0/0 cgrp=default handle=1719752
  | schedstat=( 2032583 22732170 13 )
  at dalvik.system.NativeStart.run(Native Method)

"Thread-22" prio=5 tid=20 TIMED_WAIT
  | group="main" sCount=1 dsCount=0 obj=0x405759b0 self=0x1f7700
  | sysTid=5346 nice=0 sched=0/0 cgrp=default handle=1445888
  | schedstat=( 42773840 67378464 44 )
  at java.lang.VMThread.sleep(Native Method)
  at java.lang.Thread.sleep(Thread.java:1213)
  at java.lang.Thread.sleep(Thread.java:1195)
  at com.customlbs.localization.LocatingTaskDummy.run(LocatingTaskDummy.java:57)
  at java.lang.Thread.run(Thread.java:1019)

"SurfaceLoaderThread" prio=5 tid=19 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x4055f928 self=0x1d1a90
  | sysTid=5343 nice=0 sched=0/0 cgrp=default handle=1855352
  | schedstat=( 631976786 273191742 777 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x4055f928> (a com.customlbs.android.presentation.SurfaceLoader)
  at java.lang.Object.wait(Object.java:358)
  at com.customlbs.android.presentation.SurfaceLoader.run(SurfaceLoader.java:41)

"SurfacePainterThread" prio=5 tid=18 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x4055f448 self=0x1c4d78
  | sysTid=5342 nice=0 sched=0/0 cgrp=default handle=1855152
  | schedstat=( 449782042 246506659 831 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x4055f448> (a com.customlbs.android.presentation.SurfacePainter)
  at java.lang.Object.wait(Object.java:358)
  at com.customlbs.android.presentation.SurfacePainter.run(SurfacePainter.java:99)   

1 个答案:

答案 0 :(得分:3)

  

好的,我终于找到了。 Callback.surfaceDestroyed没有等待我的绘制线程释放画布锁,现在如果我开始一个新的活动,SurfaceView.updateWindow正在等待解锁

     

- PhilippKönig4月5日12:11