gpt4 book ai didi

安卓 ANR SurfaceView

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:06:21 26 4
gpt4 key购买 nike

如果我从一个正在运行的 Activity 开始一个新的 Activity,我会一直收到 ANRs有时有一个 SurfaceView。有谁知道这个锁是干什么用的?我使用安卓支持包要使用 fragment ,我的表面 View 在 fragment 中。

----- 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)

最佳答案

Ok I finally found it. The Callback.surfaceDestroyed did not wait for my paint thread to release the canvas lock, and now if I start a new Activity the SurfaceView.updateWindow is waiting for the unlock

– Philipp König Apr 5 at 12:11

关于安卓 ANR SurfaceView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10026632/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com