在这里的时候,应用主线程已经开始启动咱们的目标窗口了,那确定是进到咱们应用当中了,那窗口为何没有呢?再联系一下trace.txt当中的调用栈信息,确定是咱们在Activity的onResume方法当中逻辑耗时过久,致使WindowManagerService没有成功添加Activity的窗口,因此事件找不到目标,没法分发,因此产生ANR了。好了,这是咱们的一个判断,那咱们还须要找证据。事件分发,咱们找一下InputDispatcher关键字,能够找到以下的信息:android
07-06 19:13:27.781 18431 19430 D SettingsInterface: from settings cache , name = sys_storage_threshold_max_bytes , value = null
07-06 19:13:27.813 18431 18597 I InputDispatcher: Application is not responding: AppWindowToken{34356a0 token=Token{8c7dc0f ActivityRecord{32a3d6e u0 com.google.android.apps.maps/com.google.android.maps.MapsActivity, isShadow:false t2134}}}. It has been 8004.7ms since event, 8002.9ms since wait started. Reason: Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.
07-06 19:13:27.827 18431 18597 I WindowManager: Input event dispatching timed out sending to application AppWindowToken{34356a0 token=Token{8c7dc0f ActivityRecord{32a3d6e u0 com.google.android.apps.maps/com.google.android.maps.MapsActivity, isShadow:false t2134}}}. Reason: Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.app
能够明显看到,在开始建立窗口,到大约6秒后,系统已经开始分发事件了,此时已经发现没有目标窗口,系统此时已经提醒咱们一次了,固然后边呢,目标窗口仍是没有建立好,最终就致使ANR了,因此方法就很明确了,就是在咱们应用的onNewIntent方法启动Activity时(Instrumentation.callActivityOnNewIntent),执行了耗时逻辑,最终致使了ANR的发生,由于这里的应用是google地图,没有源码,因此没法往下分析,也只是给你们点个思路,你们之后若是有这样的bug,能够顺着这个思路展开。
google