Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ANR errors - SCREEN OFF - How am I supposed to handle them?

I got this message on the developer console stating that my application had frozen because of:

ANR Broadcast of Intent { act=android.intent.action.SCREEN_OFF flg=0x40000000 }

There was no stack trace because this was raised by a pre-Froyo user. It doesn't even tell me which activity within my application caused the error - although I'd guess it was my Game activity.

This also matches my own experience that sometimes when my phone is running low on battery that my application will just freeze and has to be killed.

Is there something that I'm supposed to be doing within my activities to handle this freeze state?

I've now got some proper output from the market but I still don't know what to do with it.

DALVIK THREADS:
"main" prio=5 tid=1 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x400227b0 self=0xce98
  | sysTid=4060 nice=0 sched=0/0 cgrp=default handle=-1345013476
  | schedstat=( 72099976000 6131816000 28732 )
  at android.media.SoundPool.play(Native Method)
  at com.bazsoft.yaniv.SoundManager.playSound(SoundManager.java:88)
  at com.bazsoft.yaniv.YanivGameActivity.displayPileCards(YanivGameActivity.java:675)
  at com.bazsoft.yaniv.YanivGameActivity.access$22(YanivGameActivity.java:659)
  at com.bazsoft.yaniv.YanivGameActivity$1.run(YanivGameActivity.java:628)
  at android.app.Activity.runOnUiThread(Activity.java:3713)
  at com.bazsoft.yaniv.YanivGameActivity.displayCards(YanivGameActivity.java:615)
  at com.bazsoft.yaniv.YanivGameActivity.access$6(YanivGameActivity.java:614)
  at com.bazsoft.yaniv.YanivGameActivity$ComputerHandler.handleMessage(YanivGameActivity.java:121)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:143)
  at android.app.ActivityThread.main(ActivityThread.java:4701)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:859)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:617)
  at dalvik.system.NativeStart.main(Native Method)

"AsyncTask #5" prio=5 tid=19 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x464cbd98 self=0x47f208
  | sysTid=4877 nice=10 sched=0/0 cgrp=default handle=4216856
  | schedstat=( 13501000 72691000 93 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x4648bbd0> (a java.lang.VMThread)
  at java.lang.Thread.parkFor(Thread.java:1535)
  at java.lang.LangAccessImpl.parkFor(LangAccessImpl.java:48)
  at sun.misc.Unsafe.park(Unsafe.java:317)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:131)
  at  java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1996)
  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1001)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
  at java.lang.Thread.run(Thread.java:1096)

"AsyncTask #4" prio=5 tid=22 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x465379d8 self=0x460698
  | sysTid=4796 nice=10 sched=0/0 cgrp=default handle=4864896
  | schedstat=( 14816000 60081000 94 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x46491a40> (a java.lang.VMThread)
  at java.lang.Thread.parkFor(Thread.java:1535)
  at java.lang.LangAccessImpl.parkFor(LangAccessImpl.java:48)
  at sun.misc.Unsafe.park(Unsafe.java:317)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:131)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1996)
  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1001)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
  at java.lang.Thread.run(Thread.java:1096)

"AsyncTask #3" prio=5 tid=21 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x46558de8 self=0x44f1a8
  | sysTid=4759 nice=10 sched=0/0 cgrp=default handle=4865256
  | schedstat=( 17781000 122763000 125 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x46545340> (a java.lang.VMThread)
  at java.lang.Thread.parkFor(Thread.java:1535)
  at java.lang.LangAccessImpl.parkFor(LangAccessImpl.java:48)
  at sun.misc.Unsafe.park(Unsafe.java:317)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:131)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1996)
  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1001)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
  at java.lang.Thread.run(Thread.java:1096)

"Binder Thread #3" prio=5 tid=20 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x463e9610 self=0x4958e8
  | sysTid=4750 nice=0 sched=0/0 cgrp=default handle=4807336
  | schedstat=( 8851000 15266000 40 )
  at dalvik.system.NativeStart.run(Native Method)

"AsyncTask #2" prio=5 tid=18 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x464423c8 self=0x48dad8
  | sysTid=4737 nice=10 sched=0/0 cgrp=default handle=3804272
  | schedstat=( 14045000 80530000 96 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x464c2db8> (a java.lang.VMThread)
  at java.lang.Thread.parkFor(Thread.java:1535)
  at java.lang.LangAccessImpl.parkFor(LangAccessImpl.java:48)
  at sun.misc.Unsafe.park(Unsafe.java:317)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:131)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1996)
  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1001)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
  at java.lang.Thread.run(Thread.java:1096)

"AsyncTask #1" prio=5 tid=8 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x464dfed8 self=0x41b5e8
  | sysTid=4550 nice=10 sched=0/0 cgrp=default handle=3585048
  | schedstat=( 12129000 58868000 77 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x464eefa0> (a java.lang.VMThread)
  at java.lang.Thread.parkFor(Thread.java:1535)
  at java.lang.LangAccessImpl.parkFor(LangAccessImpl.java:48)
  at sun.misc.Unsafe.park(Unsafe.java:317)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:131)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1996)
  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1001)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
  at java.lang.Thread.run(Thread.java:1096)

"WebViewWorkerThread" prio=5 tid=17 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x4644d988 self=0x32d200
  | sysTid=4099 nice=1 sched=0/0 cgrp=default handle=3330880
  | schedstat=( 74615000 42294000 225 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x4644dbc8> (a android.os.MessageQueue)
  at java.lang.Object.wait(Object.java:288)
  at android.os.MessageQueue.next(MessageQueue.java:146)
  at android.os.Looper.loop(Looper.java:123)
  at android.os.HandlerThread.run(HandlerThread.java:60)

"http3" prio=5 tid=16 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x46438aa8 self=0x32c618
  | sysTid=4098 nice=1 sched=0/0 cgrp=default handle=3327832
  | schedstat=( 9630000 2435000 22 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x46437ce8> (a android.net.http.RequestQueue)
  at java.lang.Object.wait(Object.java:288)
  at android.net.http.ConnectionThread.run(ConnectionThread.java:98)

"http2" prio=5 tid=15 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x464388b8 self=0x32bbd0
  | sysTid=4097 nice=1 sched=0/0 cgrp=default handle=3325200
  | schedstat=( 6453000 547000 21 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x46437ce8> (a android.net.http.RequestQueue)
  at java.lang.Object.wait(Object.java:288)
  at android.net.http.ConnectionThread.run(ConnectionThread.java:98)

"http1" prio=5 tid=14 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x464386c8 self=0x32afb0
  | sysTid=4095 nice=1 sched=0/0 cgrp=default handle=3322096
  | schedstat=( 14060000 4044000 35 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x46437ce8> (a android.net.http.RequestQueue)
  at java.lang.Object.wait(Object.java:288)
  at android.net.http.ConnectionThread.run(ConnectionThread.java:98)

"http0" prio=5 tid=11 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x464384d8 self=0x31b898
  | sysTid=4094 nice=1 sched=0/0 cgrp=default handle=3263064
  | schedstat=( 10561000 11218000 28 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x46437ce8> (a android.net.http.RequestQueue)
  at java.lang.Object.wait(Object.java:288)
  at android.net.http.ConnectionThread.run(ConnectionThread.java:98)

"SoundPool" prio=5 tid=13 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x464237e0 self=0x2e4a08
  | sysTid=4077 nice=0 sched=0/0 cgrp=default handle=2519808
  | schedstat=( 236000 6104000 5 )
  at dalvik.system.NativeStart.run(Native Method)

"SoundPoolThread" prio=5 tid=12 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x46418800 self=0x2def70
  | sysTid=4078 nice=0 sched=0/0 cgrp=default handle=2520264
  | schedstat=( 4442000 4642000 55 )
  at dalvik.system.NativeStart.run(Native Method)

"pool-1-thread-1" prio=5 tid=10 WAIT 
  | group="main" sCount=1 dsCount=0 obj=0x463f2218 self=0x2ca760
  | sysTid=4075 nice=0 sched=0/0 cgrp=default handle=2878472
  | schedstat=( 86256000 83712000 143 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x463f2488> (a java.lang.VMThread)
  at java.lang.Thread.parkFor(Thread.java:1535)
  at java.lang.LangAccessImpl.parkFor(LangAccessImpl.java:48)
  at sun.misc.Unsafe.park(Unsafe.java:317)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:131)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1996)
  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1001)
  at java.uti...
like image 661
Barry Irvine Avatar asked Nov 10 '11 15:11

Barry Irvine


1 Answers

Android will display the ANR dialog for a particular application when it detects one of the following conditions: • No response to an input event (e.g. key press, screen touch) within 5 seconds. • A BroadcastReceiver hasn't finished executing within 10 seconds.

like image 115
Angie Avatar answered Oct 07 '22 22:10

Angie