码迷,mamicode.com
首页 > 移动开发 > 详细

Android开发中碰到的一个ANR问题。

时间:2018-01-19 14:02:03      阅读:357      评论:0      收藏:0      [点我收藏+]

标签:worker   ora   1.2   输入法   use   ini   stream   body   roi   

 

这是一个点击之后反应超时的ANR

[2018/1/12 10:25:21] 01-12 10:24:57.343   337  1279 D ActivityManager: Delay resumeKeyDispatchingLocked() to avoid deadlock.
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager: ANR in com.android.settings (com.android.settings/.LanguageSettings), time=1484121
[2018/1/12 10:25:21] ng up.)   // Reason漏了
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager: Load: 21.75 / 22.85 / 18.3
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager: Android time :[2018-01-12 10:24:57.27] [1490.278]
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager: CPU usage from 13170ms to 0ms ago:
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   106% 1609/com.**********.services: 20% user + 86% kernel / faults: 1096 minor 12 major
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   30% 337/system_server: 15% user + 14% kernel / faults: 4909 minor 75 major
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   24% 1215/android.process.media: 22% user + 1.8% kernel / faults: 4203 minor 44 major
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   12% 146/surfaceflinger: 6.8% user + 6.1% kernel / faults: 246 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   11% 4057/com.android.settings: 9.3% user + 2.4% kernel / faults: 5423 minor 19 major
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   8.9% 1965/com.**********.voiceassistant: 7.4% user + 1.5% kernel / faults: 4531 minor 96 major
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   4% 1822/ksdioirqd/mmc1: 0% user + 4% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   3.4% 106/logd: 1.8% user + 1.5% kernel / faults: 17 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   2.7% 45/kswapd0: 0% user + 2.7% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   2.1% 1564/com.*********.settings<1> (1)[1971:RadioServiceThr]i2c ioctl, cmd=0x707, arg=0xa2e1d490
[2018/1/12 10:25:21] : 1.4% user + 0.7% kernel / faults: 1118 minor 2 major
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   1.9% 72/mmcqd/0: 0% user + 1.9% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   1.6% 2218/com.android.phone: 0.9% user + 0.6% kernel / faults: 794 minor 33 major
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   1.5% 964/com.android.systemui: 1.2% user + 0.3% kernel / faults: 2244 minor 14 major
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   1.4% 1888/com.*********.carplay: 0.8% user + 0.6% kernel / faults: 382 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   1.2% 128/outhw_thread: 0% user + 1.2% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   1.2% 3850/com.**********.radio_v2: 0.9% user + 0.3% kernel / faults: 3010 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   1% 151/mediaserver: 0.6% user + 0.3% kernel / faults: 197 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.9% 183/mnld: 0.8% user + 0% kernel / faults: 101 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.5% 1824/stp_sdio_tx_rx: 0% user + 0.5% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.4% 7/rcu_preempt: 0% user + 0.4% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.3% 131/pb_stream_threa: 0% user + 0.3% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.3% 141/zygote: 0% user + 0.2% kernel / faults: 2627 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.3% 144/servicemanager: 0% user + 0.2% kernel / faults: 11 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.2% 1867/com.**********.avm.t3plus: 0.1% user + 0% kernel / faults: 637 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.2% 2320/kworker/1:2: 0% user + 0.2% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.2% 2396/kworker/u8:0: 0% user + 0.2% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.2% 2967/wpa_supplicant: 0.1% user + 0% kernel / faults: 107 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.2% 3918/kworker/u8:4: 0% user + 0.2% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.1% 122/Audin1AU: 0% user + 0.1% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.1% 133/HDMIRxTask Thre: 0% user + 0.1% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 1301/com.gislocation.android.service: 0% user + 0% kernel / faults: 871 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.1% 1638/app_process: 0% user + 0% kernel / faults: 87 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.1% 1951/com.**********.carassistant: 0% user + 0% kernel / faults: 607 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.1% 2301/com.************.btservice: 0% user + 0% kernel / faults: 737 minor 10 major
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.1% 2818/kworker/u8:1: 0% user + 0.1% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.1% 2963/hif_thread: 0% user + 0.1% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.1% 3298/com.**********.music: 0% user + 0% kernel / faults: 712 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.1% 3847/kworker/3:0: 0% user + 0.1% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.1% 3875/kworker/0:0: 0% user + 0.1% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0.1% 3876/kworker/2:1: 0% user + 0.1% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 1//init: 0% user + 0% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 10/migration/0: 0% user + 0% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 93/jbd2/mmcblk0p27: 0% user + 0% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 121/AudEsm: 0% user + 0% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 123/Audin2AU: 0% user + 0% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager   0% 13/HDMIRxCbusLink : 0% user + 0% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 135/HDMIRxCbusCmd T: 0% user + 0% kerne<1> (1)[1971:RadioServiceThr]i2c ioctl, cmd=0x707, arg=0xa2e1d470
[2018/1/12 10:25:21] l
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 186/mtk_stp_psm: 0% user + 0% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 1592/com.android.inputmethod.latin: 0% user + 0% kernel / faults: 477 minor 1 major
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 1651/com.*********.carcameras: 0% user + 0% kernel / faults: 629 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 1925/com.********.bluetooth: 0% user + 0% kernel / faults: 426 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 1982/com.android.defcontainer: 0% user + 0% kernel / faults: 468 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 2223/com.**********.quickbootmanager: 0% user + 0% kernel / faults: 1641 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 2252/com.**********.gallery: 0% user + 0% kernel / faults: 443 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 2962/tx_thread: 0% user + 0% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 3334/com.********.filemanager: 0% user + 0% kernel / faults: 443 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 3596/com.android.externalstorage: 0% user + 0% kernel / faults: 400 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:   0% 3609/android.process.media: 0% user + 0% kernel / faults: 565 minor
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager:  +0% 4124/android.process.acore: 0% user + 0% kernel
[2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager: 55% T     // Total漏了

 

初步判断是系统和服务占用资源太多,引起原生设置的ANR
在原生设置“语言和输入法”界面点击返回键是在10:24:52.563,原生设置是在10:24:52.723结束,公司设置是在10:24:57.238才收到onConfigurationChanged回调,快5秒了

                                     01-12 10:24:52.563        4057             ue to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_BACK, scanCode=0, metaState=0, flags=0x68, repeatCount=0, eventTime=1484133, downTime=1476062, deviceId=-1, source=0x101 }
                                     01-12 10:24:52.723  4057  4057 D ActivityThread: ACT-DESTROY_ACTIVITY handled : 1 / android.os.BinderProxy@5af997d
    Line 97217: [2018/1/12 10:25:20] 01-12 10:24:57.238  1564  1564 D RRIVI   : HomeActivity--TAGonConfigurationChanged 91 onConfigurationChanged com.roadrover.settings.ui.activity.HomeActivity@7c8a4d8
                [2018/1/12 10:25:21] 01-12 10:24:57.332  1564  1564 V ActivityThread: Performing resume of ActivityRecord{8570c4a token=android.os.BinderProxy@e0af7bb {com.roadrover.settings/com.roadrover.settings.ui.activity.HomeActivity}}
    Line 97346: [2018/1/12 10:25:21] 01-12 10:24:57.343   337   376 E ANRManager: ANR in com.android.settings (com.android.settings/.LanguageSettings), time=1484121
    Line 97692: [2018/1/12 10:25:21] 01-12 10:24:57.671  1564  1564 D RRIVI   : HomeActivity--TAGonCreate 84 onCreate com.roadrover.settings.ui.activity.HomeActivity@428a691
    Line 97906: [2018/1/12 10:25:21] 01-12 10:24:58.309  1564  1564 D RRIVI   : HomeActivity--TAGonResume 128 onResume com.roadrover.settings.ui.activity.HomeActivity@428a691

 

PS:ACT-DESTROY_ACTIVITY这个操作是在当前activity的onDestroy走了之后才会走得。

Android开发中碰到的一个ANR问题。

标签:worker   ora   1.2   输入法   use   ini   stream   body   roi   

原文地址:https://www.cnblogs.com/lipeineng/p/8316088.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!