Android上的清晰度没有响应对话框根本原因

时间:2016-05-11 10:45:53

标签: java android multithreading intentservice android-anr-dialog

我有一位客户正在使用我为他们创建的Android概念验证,他们报告了一个Android无响应对话框,我无法在自己的设备上重现。

所以我让他们从设备上获取traces.txt文件,它显示我的应用程序进程处于以下状态:

----- pid 28889 at 2016-05-11 11:34:41 -----
DALVIK THREADS (41):
"main" prio=5 tid=1 Suspended
  | group="main" sCount=1 dsCount=0 obj=0x779f8ea8 self=0x42427800
  | sysTid=28889 nice=0 cgrp=default sched=0/0 handle=0x40014bec
  | state=S schedstat=( 0 0 0 ) utm=58623 stm=1934 core=1 HZ=100
  | stack=0xbe0a5000-0xbe0a7000 stackSize=8MB
  | held mutexes=
  at android.os.MessageQueue.enqueueMessage(MessageQueue.java:353)
  - locked <0x2ce9a45a> (a android.os.MessageQueue)
  at android.os.Handler.enqueueMessage(Handler.java:631)
  at android.os.Handler.sendMessageAtTime(Handler.java:600)
  at android.os.Handler.sendMessageDelayed(Handler.java:570)
  at android.os.Handler.sendMessage(Handler.java:507)
  at android.app.IntentService.onStart(IntentService.java:119)
  at android.app.IntentService.onStartCommand(IntentService.java:130)
  at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3979)
  at android.app.ActivityThread.access$2300(ActivityThread.java:210)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1802)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:145)
  at android.app.ActivityThread.main(ActivityThread.java:6938)
  at java.lang.reflect.Method.invoke!(Native method)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

"JDWP" daemon prio=5 tid=3 WaitingInMainDebuggerLoop
  | group="system" sCount=1 dsCount=0 obj=0x12ca00a0 self=0x42427c00
  | sysTid=28896 nice=0 cgrp=default sched=0/0 handle=0x42503f80
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
  | stack=0x43072000-0x43074000 stackSize=1012KB
  | held mutexes=
  native: #00 pc 0003b5bc  /system/lib/libc.so (recvmsg+8)
  native: #01 pc 002909cb  /system/lib/libart.so (art::JDWP::JdwpAdbState::ReceiveClientFd()+90)
  native: #02 pc 00290abf  /system/lib/libart.so (art::JDWP::JdwpAdbState::Accept()+106)
  native: #03 pc 00196b37  /system/lib/libart.so (art::JDWP::JdwpState::Run()+286)
  native: #04 pc 0019807b  /system/lib/libart.so (art::JDWP::StartJdwpThread(void*)+10)
  native: #05 pc 00017667  /system/lib/libc.so (__pthread_start(void*)+30)
  native: #06 pc 00015687  /system/lib/libc.so (__start_thread+6)
  (no managed stack frames)

"ReferenceQueueDaemon" daemon prio=5 tid=5 Waiting
  | group="system" sCount=1 dsCount=0 obj=0x12ca30a0 self=0x4748c000
  | sysTid=28898 nice=0 cgrp=default sched=0/0 handle=0x4744f080
  | state=S schedstat=( 0 0 0 ) utm=71 stm=112 core=2 HZ=100
  | stack=0x4327c000-0x4327e000 stackSize=1036KB

"FinalizerDaemon" daemon prio=5 tid=6 Waiting
  | group="system" sCount=1 dsCount=0 obj=0x12ca3100 self=0x4748c400
  | sysTid=28899 nice=0 cgrp=default sched=0/0 handle=0x4744f580
  | state=S schedstat=( 0 0 0 ) utm=351 stm=188 core=3 HZ=100
  | stack=0x43384000-0x43386000 stackSize=1036KB

"FinalizerWatchdogDaemon" daemon prio=5 tid=8 Sleeping
  | group="system" sCount=1 dsCount=0 obj=0x12ca3160 self=0x4748c800
  | sysTid=28901 nice=0 cgrp=default sched=0/0 handle=0x4744f800
  | state=S schedstat=( 0 0 0 ) utm=0 stm=2 core=2 HZ=100
  | stack=0x47943000-0x47945000 stackSize=1036KB

"Binder_2" prio=5 tid=9 Native
  | group="main" sCount=1 dsCount=0 obj=0x12cba0a0 self=0x4242c800
  | sysTid=28902 nice=0 cgrp=default sched=0/0 handle=0x42503a80
  | state=S schedstat=( 0 0 0 ) utm=5703 stm=922 core=1 HZ=100
  | stack=0x48e04000-0x48e06000 stackSize=1012KB

"HeapTrimmerDaemon" daemon prio=5 tid=10 Sleeping
  | group="system" sCount=1 dsCount=0 obj=0x12ca31c0 self=0x4748cc00
  | sysTid=28903 nice=0 cgrp=default sched=0/0 handle=0x4744fa80
  | state=S schedstat=( 0 0 0 ) utm=2 stm=25 core=2 HZ=100
  | stack=0x53636000-0x53638000 stackSize=1036KB
  | held mutexes=
  at dalvik.system.VMRuntime.trimHeap(Native method)
  - sleeping on an unknown object
  at java.lang.Daemons$HeapTrimmerDaemon.run(Daemons.java:328)
  at java.lang.Thread.run(Thread.java:818)

"GCDaemon" daemon prio=5 tid=4 Waiting
  | group="system" sCount=1 dsCount=0 obj=0x12ca3220 self=0x4748d000
  | sysTid=28904 nice=0 cgrp=default sched=0/0 handle=0x4744fd00
  | state=S schedstat=( 0 0 0 ) utm=1611 stm=210 core=3 HZ=100
  | stack=0x5373a000-0x5373c000 stackSize=1036KB

"Measurement Worker" prio=5 tid=11 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12dc69a0 self=0x4242ac00
  | sysTid=28906 nice=0 cgrp=default sched=0/0 handle=0x42503300
  | state=S schedstat=( 0 0 0 ) utm=1 stm=0 core=3 HZ=100
  | stack=0x549cc000-0x549ce000 stackSize=1036KB

"Measurement Network" prio=5 tid=12 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12dc6a00 self=0x42428c00
  | sysTid=28907 nice=0 cgrp=default sched=0/0 handle=0x42503580
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=1 HZ=100
  | stack=0x54ad0000-0x54ad2000 stackSize=1036KB

"pool-2-thread-1" prio=5 tid=13 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12de44c0 self=0x4242f000
  | sysTid=28908 nice=0 cgrp=default sched=0/0 handle=0x42506a00
  | state=S schedstat=( 0 0 0 ) utm=0 stm=1 core=3 HZ=100
  | stack=0x54bd4000-0x54bd6000 stackSize=1036KB

"Queue" prio=10 tid=14 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12e5bfa0 self=0x42430000
  | sysTid=28909 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x42504980
  | state=S schedstat=( 0 0 0 ) utm=2 stm=0 core=3 HZ=100
  | stack=0x54cd8000-0x54cda000 stackSize=1036KB

"Queue" prio=10 tid=15 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12e640a0 self=0x42430400
  | sysTid=28910 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x42506000
  | state=S schedstat=( 0 0 0 ) utm=14 stm=3 core=2 HZ=100
  | stack=0x54ddc000-0x54dde000 stackSize=1036KB

"Queue" prio=10 tid=16 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12e64100 self=0x42430800
  | sysTid=28911 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x42506280
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
  | stack=0x54ee0000-0x54ee2000 stackSize=1036KB

"Queue" prio=10 tid=17 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12e64160 self=0x42430c00
  | sysTid=28912 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x42507400
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
  | stack=0x54fe4000-0x54fe6000 stackSize=1036KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x162011b9> (a java.lang.Object)
  at java.lang.Thread.parkFor(Thread.java:1220)
  - locked <0x162011b9> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:299)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2016)
  at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
  at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation(DependencyPriorityBlockingQueue.java:197)
  at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get(DependencyPriorityBlockingQueue.java:236)
  at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:65)
  at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:46)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  at java.lang.Thread.run(Thread.java:818)

"Queue" prio=10 tid=18 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12e641c0 self=0x42431000
  | sysTid=28913 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x42507680
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=2 HZ=100
  | stack=0x550e8000-0x550ea000 stackSize=1036KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x1f2419fe> (a java.lang.Object)
  at java.lang.Thread.parkFor(Thread.java:1220)
  - locked <0x1f2419fe> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:299)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2016)
  at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
  at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation(DependencyPriorityBlockingQueue.java:197)
  at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get(DependencyPriorityBlockingQueue.java:236)
  at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:65)
  at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:46)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  at java.lang.Thread.run(Thread.java:818)

"Answers Events Handler1" prio=5 tid=19 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12e64e20 self=0x42431c00
  | sysTid=28916 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x42507b80
  | state=S schedstat=( 0 0 0 ) utm=23 stm=10 core=2 HZ=100
  | stack=0x552f0000-0x552f2000 stackSize=1036KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x1abea55f> (a java.lang.Object)
  at java.lang.Thread.parkFor(Thread.java:1220)
  - locked <0x1abea55f> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:299)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2016)
  at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1048)
  at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:776)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  at io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:75)
  at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
  at java.lang.Thread.run(Thread.java:818)

"Crashlytics Exception Handler1" prio=5 tid=20 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12ef2520 self=0x42431400
  | sysTid=28917 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x42507e00
  | state=S schedstat=( 0 0 0 ) utm=1 stm=1 core=3 HZ=100
  | stack=0x551ec000-0x551ee000 stackSize=1036KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x00098bac> (a java.lang.Object)
  at java.lang.Thread.parkFor(Thread.java:1220)
  - locked <0x00098bac> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:299)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2016)
  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  at io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:75)
  at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
  at java.lang.Thread.run(Thread.java:818)

"Thread-4649" prio=5 tid=25 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12f2bcf0 self=0x42774800
  | sysTid=28952 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x427ed380
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=3 HZ=100
  | stack=0x56f98000-0x56f9a000 stackSize=1036KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x1fa71075> (a java.lang.Object)
  at java.lang.Thread.parkFor(Thread.java:1220)
  - locked <0x1fa71075> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:299)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2016)
  at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
  at com.android.volley.CacheDispatcher.run(CacheDispatcher.java:90)

"Thread-4650" prio=5 tid=26 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12f2bd60 self=0x42774c00
  | sysTid=28953 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x427ed100
  | state=S schedstat=( 0 0 0 ) utm=19 stm=5 core=0 HZ=100
  | stack=0x5709c000-0x5709e000 stackSize=1036KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x10a3d80a> (a java.lang.Object)
  at java.lang.Thread.parkFor(Thread.java:1220)
  - locked <0x10a3d80a> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:299)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2016)
  at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
  at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-4651" prio=5 tid=27 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12f2bdd0 self=0x42775000
  | sysTid=28954 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x427ee280
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=3 HZ=100
  | stack=0x571a0000-0x571a2000 stackSize=1036KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x2352387b> (a java.lang.Object)
  at java.lang.Thread.parkFor(Thread.java:1220)
  - locked <0x2352387b> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:299)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2016)
  at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
  at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-4652" prio=5 tid=28 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12f2be40 self=0x42775400
  | sysTid=28955 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x427ee500
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=1 HZ=100
  | stack=0x572a4000-0x572a6000 stackSize=1036KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x0159b698> (a java.lang.Object)
  at java.lang.Thread.parkFor(Thread.java:1220)
  - locked <0x0159b698> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:299)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2016)
  at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
  at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-4653" prio=5 tid=29 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12f2beb0 self=0x42775800
  | sysTid=28956 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x427edd80
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=3 HZ=100
  | stack=0x573a8000-0x573aa000 stackSize=1036KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x3a653ef1> (a java.lang.Object)
  at java.lang.Thread.parkFor(Thread.java:1220)
  - locked <0x3a653ef1> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:299)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2016)
  at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
  at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)


"AsyncTask #1" prio=5 tid=31 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12ff2f40 self=0x42779000
  | sysTid=28969 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x427eea00
  | state=S schedstat=( 0 0 0 ) utm=2 stm=2 core=2 HZ=100
  | stack=0x575dd000-0x575df000 stackSize=1036KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x25c1e157> (a java.lang.Object)
  at java.lang.Thread.parkFor(Thread.java:1220)
  - locked <0x25c1e157> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:299)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2016)
  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  at java.lang.Thread.run(Thread.java:818)

"IntentService[MSBandIS]" prio=5 tid=33 Native
  | group="main" sCount=1 dsCount=0 obj=0x13076eb0 self=0x4277d400
  | sysTid=29119 nice=0 cgrp=default sched=0/0 handle=0x427f0300
  | state=S schedstat=( 0 0 0 ) utm=10612 stm=10028 core=1 HZ=100
  | stack=0x56dc4000-0x56dc6000 stackSize=1036KB
  | held mutexes=
  native: #00 pc 0001341c  /system/lib/libc.so (syscall+28)
  native: #01 pc 000acb5b  /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+82)
  native: #02 pc 0028b215  /system/lib/libart.so (art::GoToRunnable(art::Thread*)+756)
  native: #03 pc 0008a579  /system/lib/libart.so (art::JniMethodEnd(unsigned int, art::Thread*)+8)
  native: #04 pc 00071621  /system/framework/arm/boot.oat (Java_android_database_sqlite_SQLiteConnection_nativeExecuteForLastInsertedRowId__JJ+124)
  at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native method)
  at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:952)
  at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
  at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
  at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1609)
  at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1479)
  at com.hpes.msbandtest.content.SensorProvider.insert(SensorProvider.java:150)
  at android.content.ContentProvider$Transport.insert(ContentProvider.java:243)
  at android.content.ContentResolver.insert(ContentResolver.java:1260)
  at com.hpes.msbandtest.bandlisteners.MSBandIntentService.onHandleIntent(MSBandIntentService.java:47)
  at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:145)
  at android.os.HandlerThread.run(HandlerThread.java:61)

"GAC_Executor[0]" prio=5 tid=34 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x130c2d60 self=0x4760b400
  | sysTid=29130 nice=0 cgrp=default sched=0/0 handle=0x47453680
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=3 HZ=100
  | stack=0x5788c000-0x5788e000 stackSize=1036KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x067fa444> (a java.lang.Object)
  at java.lang.Thread.parkFor(Thread.java:1220)
  - locked <0x067fa444> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:299)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2016)
  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  at java.lang.Thread.run(Thread.java:818)

"GAC_Executor[1]" prio=5 tid=36 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12edbe80 self=0x4277dc00
  | sysTid=29131 nice=0 cgrp=default sched=0/0 handle=0x427f0800
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=2 HZ=100
  | stack=0x58530000-0x58532000 stackSize=1036KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x38fdd92d> (a java.lang.Object)
  at java.lang.Thread.parkFor(Thread.java:1220)
  - locked <0x38fdd92d> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:299)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2016)
  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  at java.lang.Thread.run(Thread.java:818)

"Binder_4" prio=5 tid=40 Native
  | group="main" sCount=1 dsCount=0 obj=0x132050a0 self=0x4277b000
  | sysTid=29397 nice=0 cgrp=default sched=0/0 handle=0x5636c100
  | state=S schedstat=( 0 0 0 ) utm=5648 stm=899 core=1 HZ=100
  | stack=0x576e3000-0x576e5000 stackSize=1012KB
  | held mutexes=
  native: #00 pc 0003bccc  /system/lib/libc.so (__ioctl+8)
  native: #01 pc 00052be1  /system/lib/libc.so (ioctl+14)
  native: #02 pc 0001f5ef  /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+138)
  native: #03 pc 0001fadf  /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+6)
  native: #04 pc 0001fb41  /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+48)
  native: #05 pc 00023cd7  /system/lib/libbinder.so (???)
  native: #06 pc 000106b5  /system/lib/libutils.so (android::Thread::_threadLoop(void*)+112)
  native: #07 pc 00065369  /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+72)
  native: #08 pc 00010225  /system/lib/libutils.so (???)
  native: #09 pc 00017667  /system/lib/libc.so (__pthread_start(void*)+30)
  native: #10 pc 00015687  /system/lib/libc.so (__start_thread+6)
  (no managed stack frames)

"IntentService[DetectedActivitiesIS]" prio=5 tid=24 Native
  | group="main" sCount=1 dsCount=0 obj=0x12ddc510 self=0x4242b400
  | sysTid=30481 nice=0 cgrp=default sched=0/0 handle=0x58915980
  | state=S schedstat=( 0 0 0 ) utm=9 stm=0 core=2 HZ=100
  | stack=0x58387000-0x58389000 stackSize=1036KB
  | held mutexes=
  native: #00 pc 0003b6cc  /system/lib/libc.so (__epoll_pwait+20)
  native: #01 pc 00015923  /system/lib/libc.so (epoll_pwait+26)
  native: #02 pc 00015931  /system/lib/libc.so (epoll_wait+6)
  native: #03 pc 00012733  /system/lib/libutils.so 
----- end 28889 -----

我不得不从跟踪中删除大量文本以获得Stackoverflows限制并且跟踪相当大我为此道歉并且如果有任何遗漏可能有用请告诉我并且我将添加它回来了。

由于某种原因,主线程显然已被暂停。 Suspended指的是什么?

我还注意到它似乎在主线程报告中引用了IntentService,然后在跟踪中我们可以看到我的应用程序有两个IntentServices的引用 - IntentService [MSBandIS]&amp; IntentService [DetectedActivitiesIS] - 这两者都有“原生”,这是什么意思?它们是否正常运行?

我的应用程序中对代码的唯一引用如下:

  

在   com.hpes.msbandtest.content.SensorProvider.insert(SensorProvider.java:150)   在   android.content.ContentProvider $ Transport.insert(ContentProvider.java:243)   在android.content.ContentResolver.insert(ContentResolver.java:1260)
  在   com.hpes.msbandtest.bandlisteners.MSBandIntentService.onHandleIntent(MSBandIntentService.java:47)

这是我在内容提供程序中插入一个非常大的字符串的地方,如下所示:

@Override
    public Uri insert(Uri uri, ContentValues values) {

        /**
         * Add a new sensor record
         */
        long rowID = db.insert(SENSOR_TABLE_NAME, "", values);

        /**
         * If record is added successfully
         */

        if (rowID > 0)
        {
            Uri _uri = ContentUris.withAppendedId(CONTENT_URI, rowID);
            getContext().getContentResolver().notifyChange(_uri, null);
            return _uri;
        }
        throw new SQLException("Failed to add a record into " + uri);
    }

这是使用类似的IntentService完成的:

@Override
    protected void onHandleIntent(Intent workIntent) {
        // Gets data from the incoming Intent
        String valuesString = workIntent.getStringExtra("data");

        String test = "";

        try {
            test = CryptoHelper.getInstance(this).encryptString(valuesString);
        }catch (IllegalArgumentException e){
            return;
        }

        ContentValues values = new ContentValues(); //Create a content values object
        values.put(SensorProvider.SENSOR_DATA, test); //Add the event data

        getContentResolver().insert(
                SensorProvider.CONTENT_URI, values); //Insert into the Content provider

    }

因为你可以看到我使用加密而且String会很长但是我使用的是IntentService所以这不应该阻塞主线程,对吗?

所以我对ANR的出现感到困惑?有任何想法吗?我是否正确地阅读了这条线索,或者它是否真的指向其他东西?

添加roarster的启动服务代码:

private void insertIntoCP(String valuesString){
    Intent mServiceIntent = new Intent(mContext, MSBandIntentService.class);
    mServiceIntent.putExtra("data", valuesString);
    mContext.s.startService(mServiceIntent);
}

0 个答案:

没有答案