07-08 06:18:28.340 1535 1777 I input_focus: [Focus leaving 33ef915 cn.wps.moffice_eng/cn.wps.moffice.documentmanager.PreStartActivity (server),reason=NO_WINDOW] 07-08 06:18:29.541 1535 1650 I input_focus: [Focus request d5446e cn.wps.moffice_eng/cn.wps.moffice.spreadsheet.multiactivity.Spreadsheet1,reason=UpdateInputWindows] 07-08 06:18:29.737 1535 1777 I input_focus: [Focus entering d5446e cn.wps.moffice_eng/cn.wps.moffice.spreadsheet.multiactivity.Spreadsheet1 (server),reason=Window became focusable. Previous reason: NOT_VISIBLE]
07-08 06:18:31.465 1535 28433 I am_anr : [0,2340,com.android.launcher,751550021,Input dispatching timed out (d16b753 com.android.launcher/com.android.launcher.uioverrides.QuickstepLauncher (server) is not responding. Waited 5001ms for FocusEvent(hasFocus=false))]
这里ANR类型是(server) is not responding,Waited 5001ms for FocusEvent(hasFocus=false)
07-08 06:18:31.471 1535 28433 I AnrManager: startAnrDump 07-08 06:18:31.473 1535 28433 I AnrManager: isANRFlowSkipped() AnrFlow = 0 07-08 06:18:31.473 1535 28433 I AnrManager: enableTraceLog: false 07-08 06:18:31.495 1535 28433 I AnrManager: dumpAnrDebugInfo begin: AnrDumpRecord{ Input dispatching timed out (d16b753 com.android.launcher/com.android.launcher.uioverrides.QuickstepLauncher (server) is not responding. Waited 5001ms for FocusEvent(hasFocus=false)) ProcessRecord{b02be1a 2340:com.android.launcher/u0a102} IsCompleted:false IsCancelled:false }, onlyDumpSelf = false, isSilentANR = false 07-08 06:18:31.495 1535 28433 I AnrManager: dumpAnrDebugInfoLocked: AnrDumpRecord{ Input dispatching timed out (d16b753 com.android.launcher/com.android.launcher.uioverrides.QuickstepLauncher (server) is not responding. Waited 5001ms for FocusEvent(hasFocus=false)) ProcessRecord{b02be1a 2340:com.android.launcher/u0a102} IsCompleted:false IsCancelled:false }, onlyDumpSelf = false, isSilentANR = false 07-08 06:18:31.499 1535 28436 I AnrManager: /dev/binderfs/binder_logs/timeout_log isnt exist 07-08 06:18:31.503 1535 28433 I AnrManager: dumpStackTraces begin! 07-08 06:18:37.745 1535 28433 I AnrManager: dumpStackTraces end! 07-08 06:18:37.835 1535 28433 I AnrManager: ANR in com.android.launcher (com.android.launcher/.uioverrides.QuickstepLauncher), time=216529932 07-08 06:18:37.835 1535 28433 I AnrManager: Reason: Input dispatching timed out (d16b753 com.android.launcher/com.android.launcher.uioverrides.QuickstepLauncher (server) is not responding. Waited 5001ms for FocusEvent(hasFocus=false)) 07-08 06:18:37.835 1535 28433 I AnrManager: Load: 22.7 / 19.91 / 19.3 07-08 06:18:37.835 1535 28433 I AnrManager: ----- Output from /proc/pressure/memory ----- 07-08 06:18:37.835 1535 28433 I AnrManager: some avg10=9.01 avg60=4.60 avg300=2.72 total=6299899582 07-08 06:18:37.835 1535 28433 I AnrManager: full avg10=2.15 avg60=1.14 avg300=0.77 total=2173515838 07-08 06:18:37.835 1535 28433 I AnrManager: ----- End output from /proc/pressure/memory ----- 07-08 06:18:37.835 1535 28433 I AnrManager: ----- Output from /proc/pressure/cpu ----- 07-08 06:18:37.835 1535 28433 I AnrManager: some avg10=28.18 avg60=18.57 avg300=13.65 total=30166913113 07-08 06:18:37.835 1535 28433 I AnrManager: ----- End output from /proc/pressure/cpu ----- 07-08 06:18:37.835 1535 28433 I AnrManager: ----- Output from /proc/pressure/io ----- 07-08 06:18:37.835 1535 28433 I AnrManager: some avg10=11.14 avg60=4.59 avg300=2.76 total=6097314350 07-08 06:18:37.835 1535 28433 I AnrManager: full avg10=4.02 avg60=1.57 avg300=1.08 total=2924984916 07-08 06:18:37.835 1535 28433 I AnrManager: ----- End output from /proc/pressure/io ----- 07-08 06:18:37.835 1535 28433 I AnrManager: 07-08 06:18:37.835 1535 28433 I AnrManager: Android time :[2024-07-08 06:18:37.74] [216536.219] 07-08 06:18:37.835 1535 28433 I AnrManager: CPU usage from 21226ms to -1ms ago (2024-07-08 06:18:10.236 to 2024-07-08 06:18:31.463): 07-08 06:18:37.835 1535 28433 I AnrManager: 55% 1535/system_server: 37% user + 17% kernel / faults: 37632 minor 5929 major 07-08 06:18:37.835 1535 28433 I AnrManager: 54% 891/surfaceflinger: 38% user + 15% kernel / faults: 10184 minor 249 major 07-08 06:18:37.835 1535 28433 I AnrManager: 36% 1144/camerahalserver: 17% user + 19% kernel / faults: 27361 minor 2424 major 07-08 06:18:37.835 1535 28433 I AnrManager: 27% 16100/com.camera: 18% user + 8.8% kernel / faults: 42985 minor 1535 major 07-08 06:18:37.835 1535 28433 I AnrManager: 23% 1968/com.android.systemui: 17% user + 6.5% kernel / faults: 55296 minor 2076 major 07-08 06:18:37.835 1535 28433 I AnrManager: 21% 143/kswapd0: 0% user + 21% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 14% 854/android.hardware.graphics.composer@2.1-service: 5.7% user + 8.4% kernel / faults: 1778 minor 34 major 07-08 06:18:37.835 1535 28433 I AnrManager: 11% 445/logd: 3.6% user + 7.8% kernel / faults: 1082 minor 63 major 07-08 06:18:37.835 1535 28433 I AnrManager: 10% 2340/com.android.launcher: 4.9% user + 5% kernel / faults: 9230 minor 5915 major 07-08 06:18:37.835 1535 28433 I AnrManager: 9.6% 853/android.hardware.graphics.allocator@4.0-service-mediatek: 0.4% user + 9.2% kernel / faults: 366 minor 292 major 07-08 06:18:37.835 1535 28433 I AnrManager: 9.2% 16134/logcat: 3.3% user + 5.8% kernel / faults: 4 minor 2 major 07-08 06:18:37.835 1535 28433 I AnrManager: 8.7% 21210/com.google.android.inputmethod.latin: 5% user + 3.6% kernel / faults: 7303 minor 4885 major 07-08 06:18:37.835 1535 28433 I AnrManager: 7.1% 6133/com.google.android.gms.persistent: 4.5% user + 2.6% kernel / faults: 4767 minor 2155 major ... 07-08 06:18:37.835 1535 28433 I AnrManager: 74% TOTAL: 36% user + 32% kernel + 2.4% iowait + 2.2% irq + 1.1% softirq 07-08 06:18:37.835 1535 28433 I AnrManager: CPU usage from 170ms to 1126ms later (2024-07-08 06:18:31.632 to 2024-07-08 06:18:32.588): 07-08 06:18:37.835 1535 28433 I AnrManager: 196% 1535/system_server: 106% user + 89% kernel / faults: 4198 minor 693 major 07-08 06:18:37.835 1535 28433 I AnrManager: 58% 1630/Signal Catcher: 34% user + 24% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 57% 28435/AnrAuxiliaryTas: 17% user + 40% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 12% 1637/binder:1535_1: 9.3% user + 2.6% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 5.3% 1633/HeapTaskDaemon: 5.3% user + 0% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 5.3% 1650/android.anim: 5.3% user + 0% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 4% 1651/android.anim.lf: 2.6% user + 1.3% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 2.6% 1638/binder:1535_2: 2.6% user + 0% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 2.6% 1666/OomAdjuster: 1.3% user + 1.3% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 2.6% 1667/batterystats-ha: 2.6% user + 0% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 2.6% 1704/binder:1535_3: 2.6% user + 0% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 2.6% 1717/eduling.default: 1.3% user + 1.3% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 2.6% 1749/SettingsProvide: 1.3% user + 1.3% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 2.6% 3299/binder:1535_11: 1.3% user + 1.3% kernel ... 07-08 06:18:37.835 1535 28433 I AnrManager: 4.3% 2340/com.android.launcher: 2.8% user + 1.4% kernel / faults: 29 minor 1 major 07-08 06:18:37.835 1535 28433 I AnrManager: 1.4% 2399/UiThreadHelper: 1.4% user + 0% kernel 07-08 06:18:37.835 1535 28433 I AnrManager: 1.4% 26754/binder:2340_D: 0% user + 1.4% kernel ... 07-08 06:18:37.835 1535 28433 I AnrManager: 79% TOTAL: 44% user + 32% kernel + 0.1% iowait + 2% irq + 0.6% softirq 07-08 06:18:37.835 1535 28433 I AnrManager: dumpAnrDebugInfo end: AnrDumpRecord{ Input dispatching timed out (d16b753 com.android.launcher/com.android.launcher.uioverrides.QuickstepLauncher (server) is not responding. Waited 5001ms for FocusEvent(hasFocus=false)) ProcessRecord{b02be1a 2340:com.android.launcher/u0a102} IsCompleted:true IsCancelled:false }, onlyDumpSelf = false , isSilentANR = false 07-08 06:18:37.835 1535 28433 I AnrManager: addErrorToDropBox app = ProcessRecord{b02be1a 2340:com.android.launcher/u0a102} processName = com.android.launcher activityShortComponentName = com.android.launcher/.uioverrides.QuickstepLauncher parentShortComponentName = com.android.launcher/.uioverrides.QuickstepLauncher parentProcess = ProcessRecord{b02be1a 2340:com.android.launcher/u0a102} annotation = Input dispatching timed out (d16b753 com.android.launcher/com.android.launcher.uioverrides.QuickstepLauncher (server) is not responding. Waited 5001ms for FocusEvent(hasFocus=false)) mTracesFile = /data/anr/anr_2024-07-08-06-18-31-504 07-08 06:18:37.836 1535 28433 I AnrManager: controller = android.app.IActivityController$Stub$Proxy@8129e54
在ANR发生前,总的负载为79,按照我们之前的流程图看,比95低,因此认为负载是正常的。
从上面分析,负载正常,Eventlog中没有其他异常信息,因此还是要去logcat中查找有关信息,
1 2 3 4 5 6
07-08 06:18:28.476 2340 3422 D BLASTBufferQueue: [VRI[Taskbar]#756](f:1,a:3) flush out the shadow queue, before 07-08 06:18:28.476 2340 3422 D BLASTBufferQueue: [VRI[Taskbar]#756](f:0,a:3) flush out the shadow queue, after 07-08 06:18:28.476 2340 3422 E BLASTBufferQueue: [VRI[Taskbar]#756](f:1,a:3) acquireNextBufferLocked: Can't acquire next buffer. Already acquired max frames 3 max:1 + 2 07-08 06:18:28.476 2340 3422 D BLASTBufferQueue: [VRI[Taskbar]#756](f:1,a:3) waiting for available buffer
07-08 06:18:31.387 1535 1777 I WindowManager: ANR in Window{d16b753 u0 com.android.launcher/com.android.launcher.uioverrides.QuickstepLauncher}. Reason:Input dispatching timed out (d16b753 com.android.launcher/com.android.launcher.uioverrides.QuickstepLauncher (server) is not responding. Waited 5001ms for FocusEvent(hasFocus=false))
----- pid 2245 at 2024-04-19 19:54:24.040490541+0800 ----- Cmd line: com.android.launcher Build fingerprint: 'xxx/release-keys' ABI: 'arm64' Build type: optimized suspend all histogram: Sum: 39.921ms 99% C.I. 2.600us-1739.519us Avg: 62.279us Max: 16823us DALVIK THREADS (49): "main" prio=5 tid=1 Native | group="main" sCount=1 ucsCount=0 flags=1 obj=0x73a5a1a8 self=0xb400007080a3bc00 | sysTid=2245 nice=-10 cgrp=top-app sched=1073741824/0 handle=0x712c79a4f8 | state=S schedstat=( 126041218432 69365881314 284094 ) utm=9893 stm=2711 core=2 HZ=100 | stack=0x7fcee5b000-0x7fcee5d000 stackSize=8188KB | held mutexes= native: #00 pc 0009013c /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28) (BuildId: 48e8d7222e541f85801757f11a93754f) native: #01 pc 00094f10 /apex/com.android.runtime/lib64/bionic/libc.so (__futex_wait_ex+144) (BuildId: 48e8d7222e541f85801757f11a93754f) native: #02 pc 00100e68 /apex/com.android.runtime/lib64/bionic/libc.so (pthread_cond_wait+72) (BuildId: 48e8d7222e541f85801757f11a93754f) native: #03 pc 00298570 /system/lib64/libhwui.so (android::uirenderer::renderthread::DrawFrameTask::drawFrame+368) (BuildId: 41926fe0178947b68880fb6e7fc98ad0) at android.graphics.HardwareRenderer.nSyncAndDrawFrame(Native method) at android.graphics.HardwareRenderer.syncAndDrawFrame(HardwareRenderer.java:484) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:829) at android.view.ViewRootImpl.draw(ViewRootImpl.java:5237) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4923) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4061) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2629) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9837) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1614) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1623) at android.view.Choreographer.doCallbacks(Choreographer.java:1170) at android.view.Choreographer.doFrame(Choreographer.java:1062) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1597) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:240) at android.os.Looper.loop(Looper.java:346) at android.app.ActivityThread.main(ActivityThread.java:8344) at java.lang.reflect.Method.invoke(Native method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:594) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
这里也是Native状态,主线程阻塞,但是这次是在nSyncAndDrawFrame方法。
Event log
1
06-14 19:40:31.867 1554 21277 I am_anr : [0,4085,com.android.launcher,751550021,Input dispatching timed out (Application does not have a focused window)]
06-14 19:40:49.985 1554 21277 I AnrManager: ANR in com.android.launcher (com.android.launcher/.uioverrides.QuickstepLauncher), time=13683968 06-14 19:40:49.985 1554 21277 I AnrManager: Reason: Input dispatching timed out (Application does not have a focused window) 06-14 19:40:49.985 1554 21277 I AnrManager: Load: 18.3 / 18.47 / 18.41 06-14 19:40:49.985 1554 21277 I AnrManager: ----- Output from /proc/pressure/memory ----- 06-14 19:40:49.985 1554 21277 I AnrManager: some avg10=0.65 avg60=1.00 avg300=1.22 total=144511924 06-14 19:40:49.985 1554 21277 I AnrManager: full avg10=0.06 avg60=0.25 avg300=0.39 total=60951364 06-14 19:40:49.985 1554 21277 I AnrManager: ----- End output from /proc/pressure/memory ----- 06-14 19:40:49.985 1554 21277 I AnrManager: ----- Output from /proc/pressure/cpu ----- 06-14 19:40:49.985 1554 21277 I AnrManager: some avg10=8.78 avg60=13.07 avg300=13.79 total=1605682826 06-14 19:40:49.985 1554 21277 I AnrManager: ----- End output from /proc/pressure/cpu ----- 06-14 19:40:49.985 1554 21277 I AnrManager: ----- Output from /proc/pressure/io ----- 06-14 19:40:49.985 1554 21277 I AnrManager: some avg10=2.61 avg60=2.94 avg300=2.10 total=247732292 06-14 19:40:49.985 1554 21277 I AnrManager: full avg10=0.77 avg60=0.95 avg300=0.67 total=113604927 06-14 19:40:49.985 1554 21277 I AnrManager: ----- End output from /proc/pressure/io ----- 06-14 19:40:49.985 1554 21277 I AnrManager: 06-14 19:40:49.985 1554 21277 I AnrManager: Android time :[2024-06-14 19:40:49.85] [13701.962] 06-14 19:40:49.985 1554 21277 I AnrManager: CPU usage from 11676ms to -1ms ago (2024-06-14 19:40:20.189 to 2024-06-14 19:40:31.866): 06-14 19:40:49.985 1554 21277 I AnrManager: 56% 1554/system_server: 28% user + 27% kernel / faults: 10363 minor 1568 major 06-14 19:40:49.985 1554 21277 I AnrManager: 20% 426/servicemanager: 1.7% user + 18% kernel / faults: 735 minor 06-14 19:40:49.985 1554 21277 I AnrManager: 19% 891/surfaceflinger: 11% user + 8.8% kernel / faults: 1211 minor 3 major 06-14 19:40:49.985 1554 21277 I AnrManager: 9.6% 21048/com.android.settings: 7.1% user + 2.4% kernel / faults: 2693 minor 06-14 19:40:49.985 1554 21277 I AnrManager: 7.7% 424/logd: 2.3% user + 5.3% kernel / faults: 459 minor 1 major 06-14 19:40:49.985 1554 21277 I AnrManager: 7.8% 18410/com.google.android.apps.adm: 5.9% user + 1.8% kernel / faults: 7366 minor 313 major 06-14 19:40:49.985 1554 21277 I AnrManager: 6.7% 143/kswapd0: 0% user + 6.7% kernel 06-14 19:40:49.985 1554 21277 I AnrManager: 6.1% 4085/com.android.launcher: 4.6% user + 1.5% kernel / faults: 7034 minor 1460 major 06-14 19:40:49.985 1554 21277 I AnrManager: 5.9% 881/android.hardware.memtrack-service.mediatek: 0.6% user + 5.3% kernel / faults: 583 minor 06-14 19:40:49.985 1554 21277 I AnrManager: 5.6% 12322/com.google.android.googlequicksearchbox:search: 4.2% user + 1.4% kernel / faults: 3970 minor 8 major 06-14 19:40:49.985 1554 21277 I AnrManager: 5.5% 16026/com.google.android.apps.maps: 2.5% user + 3% kernel / faults: 8714 minor 2220 major 06-14 19:40:49.985 1554 21277 I AnrManager: 5.2% 871/android.hardware.graphics.composer@2.1-service: 2% user + 3.1% kernel / faults: 620 minor .... 06-14 19:40:49.985 1554 21277 I AnrManager: 92% 1554/system_server: 32% user + 59% kernel / faults: 1733 minor 56 major 06-14 19:40:49.985 1554 21277 I AnrManager: 65% 21278/AnrAuxiliaryTas: 18% user + 47% kernel 06-14 19:40:49.985 1554 21277 I AnrManager: 7.6% 1614/Signal Catcher: 4.6% user + 3% kernel 06-14 19:40:49.985 1554 21277 I AnrManager: 3% 1632/android.display: 1.5% user + 1.5% kernel 06-14 19:40:49.985 1554 21277 I AnrManager: 3% 1641/android.bg: 1.5% user + 1.5% kernel 06-14 19:40:49.985 1554 21277 I AnrManager: 3% 1642/ActivityManager: 0% user + 3% kernel 06-14 19:40:49.985 1554 21277 I AnrManager: 3% 21277/AnrConsumer: 0% user + 3% kernel 06-14 19:40:49.985 1554 21277 I AnrManager: 1.5% 1630/android.ui: 0% user + 1.5% kernel ... 06-14 19:40:49.985 1554 21277 I AnrManager: 31% TOTAL: 10% user + 17% kernel + 0.6% iowait + 0.9% irq + 0.9% softirq 06-14 19:40:49.985 1554 21277 I AnrManager: dumpAnrDebugInfo end: AnrDumpRecord{ Input dispatching timed out (Application does not have a focused window) ProcessRecord{5e22c06 4085:com.android.launcher/u0a82} IsCompleted:true IsCancelled:false }, onlyDumpSelf = false , isSilentANR = false 06-14 19:40:49.986 1554 21277 I AnrManager: addErrorToDropBox app = ProcessRecord{5e22c06 4085:com.android.launcher/u0a82} processName = com.android.launcher activityShortComponentName = com.android.launcher/.uioverrides.QuickstepLauncher parentShortComponentName = com.android.launcher/.uioverrides.QuickstepLauncher parentProcess = ProcessRecord{5e22c06 4085:com.android.launcher/u0a82} annotation = Input dispatching timed out (Application does not have a focused window) mTracesFile = /data/anr/anr_2024-06-14-19-40-32-056 06-14 19:40:49.991 1554 21277 I AnrManager: controller = android.app.IActivityController$Stub$Proxy@f8cbdda
从上面看内存,cpu负载都是正常范围内,因此负载没有问题。
根据实例一,还是需要去logcat中查找有效信息,
1 2 3 4 5
06-14 19:40:29.438 4085 5122 D BLASTBufferQueue: [VRI[Taskbar]#4](f:1,a:4) waiting for available buffer timeout 06-14 19:40:29.452 4085 5122 D BLASTBufferQueue: [VRI[Taskbar]#4](f:1,a:4) flush out the shadow queue, before 06-14 19:40:29.452 4085 5122 D BLASTBufferQueue: [VRI[Taskbar]#4](f:0,a:4) flush out the shadow queue, after 06-14 19:40:29.452 4085 5122 E BLASTBufferQueue: [VRI[Taskbar]#4](f:1,a:4) acquireNextBufferLocked: Can't acquire next buffer. Already acquired max frames 4 max:2 + 2 06-14 19:40:29.452 4085 5122 D BLASTBufferQueue: [VRI[Taskbar]#4](f:1,a:4) waiting for available buffer