Code flow of ANR


  • Code flow of InputSystem

Android ANR-Keydispatch timeout_第1张图片

  • Code flow of dispatch input event
    Android ANR-Keydispatch timeout_第2张图片
    Android ANR-Keydispatch timeout_第3张图片

flow of Scenario


normal flow
Android ANR-Keydispatch timeout_第4张图片

// notifyKey() / notifyMotion()01-15 11:55:56.713   937  1127 D InputDispatcher: notifyM-evT=1156348,dev=1,src=0x1002, ac=0x0, downT=115634801-15 11:55:56.713   937  1127 D InputDispatcher: id[0]=0,tool=1,x=670,y=1246// dispatchKeyLocked() / dispatchMotionLocked() -> dispatchEventLocked()// dispatchEventLocked to every inputTarget01-15 11:55:56.713   937  1126 D InputDispatcher: DispatchM[0]42644ed8 NavigationBar (s),evT=1156348,curT=115635101-15 11:55:56.713   937  1126 D InputDispatcher: DispatchM[0]425a5d78 StatusBar (s),evT=1156348,curT=115635101-15 11:55:56.713   937  1126 D InputDispatcher: DispatchM[0]4354eee0 com.android.settings.Settings (s),evT=1156348,curT=115635101-15 11:55:56.713   937  1126 D InputDispatcher: DispatchM[0]WindowManager (s),evT=1156348,curT=1156351// finishDispatchCycleLocked() -> ... -> doDispatchCycleFinishedLockedInterruptible()01-15 11:55:56.713   937  1126 D InputDispatcher: FinishedM-evT=115634801-15 11:55:56.713   937  1126 D InputDispatcher: FinishedM-evT=115634801-15 11:55:56.713   937  1126 D InputDispatcher: FinishedM-evT=115634801-15 11:55:56.713   937  1126 D InputDispatcher: FinishedM-evT=1156348

No focused window
Android ANR-Keydispatch timeout_第5张图片

@ bugreportInput Dispatcher State at time of last ANR:  ANR:    Time: 2014-02-20 12:13:15    Window: AppWindowToken{4282ed50 token=Token{42755b28 ActivityRecord{42485160 u0 com.htc.camera/.CameraEntry t23}}}    DispatchLatency: 5022.9ms    WaitDuration: 5005.4ms    Reason: Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.  DispatchEnabled: 1  DispatchFrozen: 0  FocusedApplication: name='AppWindowToken{4282ed50 token=Token{42755b28 ActivityRecord{42485160 u0 com.htc.camera/.CameraEntry t23}}}', dispatchingTimeout=5000.000ms  FocusedWindow: name=''...Windows:...PendingEvent:    KeyEvent(deviceId=-1, source=0x00000101, action=0, flags=0x00000048, keyCode=4, scanCode=0, metaState=0x00000000, repeatCount=0), policyFlags=0x4b000100, age=5025.8msInboundQueue: length=5    MotionEvent(deviceId=2, source=0x00001002, action=2, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, edgeFlags=0x00000000, xPrecision=1.5, yPrecision=1.5, displayId=0, pointers=[0: (1266.0, 569.5)]), policyFlags=0x42000000, age=5015.0ms...    KeyEvent(deviceId=-1, source=0x00000101, action=0, flags=0x000000c8, keyCode=4, scanCode=0, metaState=0x00000000, repeatCount=1), policyFlags=0x4b000100, age=4520.8ms

event not finished
Android ANR-Keydispatch timeout_第6张图片

// 1st touch: dispatch not finished (waitQueue can’t consume: 2*DispatchM but 1*FinishedM)02-14 17:29:59.664   969  1058 D InputDispatcher: notifyM-evT=67123340,dev=3,src=0x1002, ac=0x1, downT=6712310202-14 17:29:59.664   969  1058 D InputDispatcher: id[0]=0,tool=1,x=459,y=102302-14 17:29:59.664   969  1057 D InputDispatcher: DispatchM[1]4263bbf0 com.android.development.BadBehaviorActivity (s),evT=67123340,curT=6712334102-14 17:29:59.664   969  1057 D InputDispatcher: DispatchM[1]WindowManager (s),evT=67123340,curT=6712334102-14 17:29:59.664   969  1057 D InputDispatcher: FinishedM-evT=67123341//     - mPendingEvent = NULL// 2nd touch: 02-14 17:30:01.576   969  1058 D InputDispatcher: notifyM-evT=67125255,dev=3,src=0x1002, ac=0x0, downT=6712525502-14 17:30:01.576   969  1058 D InputDispatcher: id[0]=0,tool=1,x=433,y=104202-14 17:30:01.576   969  1057 D InputDispatcher: Waiting for application to become ready for input: Window{4263bbf0 u0 com.android.development/com.android.development.BadBehaviorActivity}.  Reason: Waiting because the touched window has not finished processing the input events that were previously delivered to it.// findFocusedWindowTargetsLocked() -> handleTargetsNotReadyLocked()//     - waitCause = INPUT_TARGET_WAIT_CAUSE_APPLICATION_NOT_READY;//     - waitTimeoutTime = 17:30:01.576 + {5sec}//     - Looper’s nextWakeupTime = 17:30:01.576 + {5sec}//     - mPendingEvent = 2nd touch// after 5sec, Looper wakeup// dispatchOnceInnerLocked() -> handleTargetsNotReadyLocked() -> onANRLocked()02-14 17:30:06.581   969  1057 I InputDispatcher: Application is not responding: Window{4263bbf0 u0 com.android.development/com.android.development.BadBehaviorActivity}.  It has been 5005.5ms since event, 5005.1ms since wait started.  Reason: Waiting because the touched window has not finished processing the input events that were previously delivered to it.

更多相关文章

  1. [记录点滴]在Ionic和Android中上传Blob图片
  2. android 实现保存图片到相册
  3. android图片裁剪
  4. Android 中保存图片的代码
  5. android之将图片转化为圆形图片
  6. Android 使用decodeFile方法加载手机磁盘中的图片文件
  7. Android:使用SpannableString实现图片替换相应的文字
  8. Android 加载图片并存放在缓存中
  9. android 实现图片的裁剪

随机推荐

  1. Linux下Android(安卓)ADB驱动安装详解
  2. android java打印栈信息
  3. FregClient和FregServer进程间通信
  4. android邮件发送几种方式
  5. android客户端利用sokcet通信和向Java服
  6. Android(安卓)AnimationDrawable动画实例
  7. eclipse中修改工程的Android版本
  8. Android通过http协议POST传输方式
  9. cocos2dx 调用java层代码
  10. Android(安卓)中自定义 Adapter