Android MONKEY ANR在android.os.MessageQueue.nativePollOnce

时间:2017-01-06 03:46:54

标签: android monkey

使用MONKEY测试我们的应用程序时,我们发现了一个棘手的ANR问题。

CPU和内存使用处于正常水平。

似乎ANR是由一个由MONKEY发送到我们应用程序活动的假冒的Timeout KeyEvent引起的。 以下是日志的一部分:

“
ANR:
    Time: 2016-12-29 15:36:08
    Window: AppWindowToken{56a48d3 token=Token{abb12c2 ActivityRecord{cb0230d u0 <our app’s activity> t34}}} - Window{40c381a u0 <our app’s activity>}
    DispatchLatency: 5005.0ms
    WaitDuration: 5003.6ms
    Reason: Waiting to send key event because the focused window has not finished processing all of the input events that were previously delivered to it.  Outbound queue length: 0.  Wait queue length: 1.

 ANR:
11: channelName='40c381a <our app’s activity> (server)', windowName='Window{40c381a u0 <our app’s activity>', status=NORMAL, monitor=false, inputPublisherBlocked=false
      OutboundQueue: <empty>
      WaitQueue: length=1
        KeyEvent(deviceId=-1, source=0x00000101, action=0, flags=0x00000008, keyCode=82, scanCode=0, metaState=0x00000000, repeatCount=0), policyFlags=0x6b000000, eventT=12621294000000, targetFlags=0x00000101, resolvedAction=0, age=5014.4ms, wait=5011.8ms
”

But the trace log is
“
"main" prio=5 tid=1 Native
  | group="main" sCount=1 dsCount=0 obj=0x75fc23f0 self=0x7fa2f04a00
  | sysTid=1478 nice=0 cgrp=default sched=0/0 handle=0x7fa321ba98
  | state=S schedstat=( 0 0 0 ) utm=3806 stm=1660 core=0 HZ=100
  | stack=0x7fca45d000-0x7fca45f000 stackSize=8MB
  | held mutexes=
  kernel: __switch_to+0x7c/0x88
  kernel: SyS_epoll_wait+0x298/0x328
  kernel: SyS_epoll_pwait+0xa4/0x118
  kernel: el0_svc_naked+0x24/0x28
  native: #00 pc 000000000006b418  /system/lib64/libc.so (__epoll_pwait+8)
  native: #01 pc 000000000001e7cc  /system/lib64/libc.so (epoll_pwait+64)
  native: #02 pc 000000000001a26c  /system/lib64/libutils.so (_ZN7android6Looper9pollInnerEi+156)
  native: #03 pc 000000000001a120  /system/lib64/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+60)
  native: #04 pc 00000000000ef3bc  /system/lib64/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+48)
  native: #05 pc 00000000008e8000  /system/framework/arm64/boot-framework.oat (Java_android_os_MessageQueue_nativePollOnce__JI+140)
  at android.os.MessageQueue.nativePollOnce(Native method)
  at android.os.MessageQueue.next(MessageQueue.java:323)
  at android.os.Looper.loop(Looper.java:145)
  at com.android.server.SystemServer.run(SystemServer.java:419)
  at com.android.server.SystemServer.main(SystemServer.java:239)
  at java.lang.reflect.Method.invoke!(Native method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:938)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828)
”

我们的主要线程是等待从MessageQueue获取消息。 inputmanager将KeyEvent发送到我们的Activity,但我们的主线程似乎没有收到事件,仍在等待消息处理。

导致这个问题的原因是什么?

0 个答案:

没有答案