Android ANR SurfaceView
如果我从具有SurfaceView的正在运行的Activity中启动一个新的Activity,我会不时得到ANR。 有谁知道这个锁是关于什么的? 我使用android支持包来使用片段,我的surfaceview在一个片段中。
----- 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)
好吧,我终于找到了。 Callback.surfaceDestroyed
并没有等待我的绘制线程释放画布锁,现在如果我启动一个新的Activity, SurfaceView.updateWindow
正在等待解锁
- PhilippKönig4月5日12:11
链接地址: http://www.djcxy.com/p/10625.html下一篇: python argparse to handle arbitrary numeric options (like HEAD(1))