1

我从 google play 获得了下面的堆栈,但我不明白为什么:

来自 PlayerCardsEventsListner.select 的来源:

void select(Card card) {
    card.select(!card.isSelected());
    if (card.isSelected()) card.setPosition(card.getPosition().x, card.getPosition().y-10);
    else card.setPosition(card.getPosition().x, card.getPosition().y+10);           
    SoundManager.playSound(SoundManager.SOUND_DROP, 1);
}

声音管理器:声音管理器

DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0 hwl=0 hwll=0)
"main" prio=5 tid=1 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x400281b8 self=0xcec0
  | sysTid=5424 nice=0 sched=0/0 cgrp=default handle=-1345006496
  | schedstat=( 895401208047 31823023961 248727 )
  at android.media.SoundPool.play(Native Method)
  at com.burraco.sound.SoundManager.playSound(SoundManager.java:66)
  at com.burraco.actions.PlayerCardsEventsListner.select(PlayerCardsEventsListner.java:157)
  at com.burraco.actions.PlayerCardsEventsListner.actionDown(PlayerCardsEventsListner.java:79)
  at com.burraco.actions.PlayerCardsEventsListner.onTouch(PlayerCardsEventsListner.java:38)
  at android.view.View.dispatchTouchEvent(View.java:3934)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1730)
  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1142)
  at android.app.Activity.dispatchTouchEvent(Activity.java:2102)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1714)
  at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2218)
  at android.view.ViewRoot.handleMessage(ViewRoot.java:1889)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  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:847)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
  at dalvik.system.NativeStart.main(Native Method)

"Binder Thread #3" prio=5 tid=9 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40652e20 self=0x28d378
  | sysTid=5620 nice=0 sched=0/0 cgrp=default handle=5810464
  | schedstat=( 3221792 16373336 20 )
  at dalvik.system.NativeStart.run(Native Method)

"Thread-14" prio=5 tid=8 TIMED_WAIT
  | group="main" sCount=1 dsCount=0 obj=0x40556c80 self=0x142b90
  | sysTid=5520 nice=0 sched=0/0 cgrp=default handle=1618728
  | schedstat=( 174148198 257597779 1253 )
  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.burraco.ai.AiThread.run(AiThread.java:77)
  at java.lang.Thread.run(Thread.java:1019)

"SoundPoolThread" prio=5 tid=12 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x4053c8b0 self=0x145530
  | sysTid=5472 nice=0 sched=0/0 cgrp=default handle=1250072
  | schedstat=( 3314498 173708645 36 )
  at dalvik.system.NativeStart.run(Native Method)

"SoundPool" prio=5 tid=11 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x405352d8 self=0x1429a0
  | sysTid=5471 nice=0 sched=0/0 cgrp=default handle=1249960
  | schedstat=( 3432419 260185822 78 )
  at dalvik.system.NativeStart.run(Native Method)

"android.hardware.SensorManager$SensorThread" prio=5 tid=10 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x4052ff48 self=0x150148
  | sysTid=5441 nice=-8 sched=0/0 cgrp=default handle=1376896
  | schedstat=( 2404922708 1733708167 21400 )
  at android.hardware.SensorManager.sensors_data_poll(Native Method)
  at android.hardware.SensorManager$SensorThread$SensorThreadRunnable.run(SensorManager.java:454)
  at java.lang.Thread.run(Thread.java:1019)

"Binder Thread #2" prio=5 tid=7 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x4051c5b0 self=0x8b2c8
  | sysTid=5430 nice=0 sched=0/0 cgrp=default handle=569024
  | schedstat=( 5665377 70979176 41 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #1" prio=5 tid=6 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x4051b2f0 self=0x899a8
  | sysTid=5429 nice=0 sched=0/0 cgrp=default handle=1010768
  | schedstat=( 8561334 52181668 45 )
  at dalvik.system.NativeStart.run(Native Method)

"Compiler" daemon prio=5 tid=5 VMWAIT
  | group="system" sCount=1 dsCount=0 obj=0x40517300 self=0xf65b0
  | sysTid=5428 nice=0 sched=0/0 cgrp=default handle=1007392
  | schedstat=( 672164310 233385368 5749 )
  at dalvik.system.NativeStart.run(Native Method)

"Signal Catcher" daemon prio=5 tid=4 RUNNABLE
  | group="system" sCount=0 dsCount=0 obj=0x40517240 self=0xf6398
  | sysTid=5427 nice=0 sched=0/0 cgrp=default handle=479464
  | schedstat=( 1154248 170503189 8 )
  at dalvik.system.NativeStart.run(Native Method)

"GC" daemon prio=5 tid=3 VMWAIT
  | group="system" sCount=1 dsCount=0 obj=0x40517198 self=0xf61a0
  | sysTid=5426 nice=0 sched=0/0 cgrp=default handle=1002744
  | schedstat=( 8751048544 2309042697 2446 )
  at dalvik.system.NativeStart.run(Native Method)

"HeapWorker" daemon prio=5 tid=2 VMWAIT
  | group="system" sCount=1 dsCount=0 obj=0x405170e0 self=0xf5fb0
  | sysTid=5425 nice=0 sched=0/0 cgrp=default handle=1007176
  | schedstat=( 10792780877 2156866454 3466 )
  at dalvik.system.NativeStart.run(Native Method)
4

1 回答 1

0

首先,select(Card card)在哪里调用?. 这对于避免主 UI 线程中的日志操作(在活动中执行的标准操作,例如 onCreate())非常重要。如果你不小心运行了一些循环,或者死锁发生的 UI 将冻结并且 ANR 会被注意到。尝试使用 AsyncTask 播放声音并检查方法执行的时间。请记住,较慢的设备需要更多时间来执行操作。好的,现在看看它在哪里被调用。

于 2012-07-19T15:52:27.647 回答