title: Why android treats an app in ANR when it is in the looper waiting
body: <p>In my android logcat log, I see:</p>
  
  <pre><code>01-02 02:01:46.523 E/ActivityManager(  459): ANR in com.android.phone (com.android.phone/.InCallScreen)
  </code></pre>
  
  <p>And then when I go to /data/anr/traces.txt, I see</p>
  
  <pre><code>Cmd line: com.android.phone
  
  DALVIK THREADS:
  (mutexes: tll=0 tsl=0 tscl=0 ghl=0)
  
  "main" prio=5 tid=1 NATIVE
    | group="main" sCount=1 dsCount=0 obj=0x410f7508 self=0x40eeeb68
    | sysTid=649 nice=0 sched=0/0 cgrp=apps handle=1075429168
    | schedstat=( 0 0 0 ) utm=1361 stm=314 core=1
    #00  pc 0000dac0  /system/lib/libc.so (epoll_wait+12)
    #01  pc 00014899  /system/lib/libutils.so (android::Looper::pollInner(int)+96)
    #02  pc 00014b01  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+104)
    #03  pc 00063aeb  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
    #04  pc 0001df30  /system/lib/libdvm.so (dvmPlatformInvoke+112)
    #05  pc 0004d1fb  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+394)
    #06  pc 00038f4d  /system/lib/libdvm.so (dvmCheckCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+8)
    #07  pc 00000214  /dev/ashmem/dalvik-jit-code-cache (deleted)
    at android.os.MessageQueue.nativePollOnce(Native Method)
    at android.os.MessageQueue.next(MessageQueue.java:125)
    at android.os.Looper.loop(Looper.java:124)
    at android.app.ActivityThread.main(ActivityThread.java:4921)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>My question is why android thinks the app is in ANR when the stack trace shows the main thread in Looper waiting for message?  That seems normal to me. I understand android shows ANR when the main thread is downloading something/doing a long operation. But it seems normal that it is waiting for a message. Please corect me if I am wrong.</p>