当前位置:   article > 正文

Input事件window paused timeout导致ANR问题整理_window is paused

window is paused

Input事件window paused timeout导致ANR问题整理,最近几个项目多次出现如下类型的ANR

Activity: com.android.systemui/.settings.BrightnessDialog
Subject: Input dispatching timed out (Waiting because the touched window is paused.)

分析多份log,基本都是这个Activity发生的ANR,发生场景相同,可归为一类问题

如下记录一下对于此问题的分析:

发生ANR时间点:

01-01 12:12:51.225725  1075  1277 I WindowManager: Input event dispatching timed out sending to com.android.systemui/com.android.systemui.settings.BrightnessDialog.  Reason: Waiting because the touched window is paused.

01-01 12:12:51.336500  1075  1201 I am_anr  : [0,2479,com.android.systemui,818429453,Input dispatching timed out (Waiting because the touched window is paused.)]

BrightnessDialog Activity信息:

01-01 12:12:43.840221  2479  2479 I am_on_resume_called: [0,com.android.systemui.settings.BrightnessDialog,RESUME_ACTIVITY]

01-01 12:12:45.980270 1075 3522 I am_pause_activity: [0,225503206,com.android.systemui/.settings.BrightnessDialog,userLeaving=true]
01-01 12:12:45.981149 2479 2479 I am_on_paused_called: [0,com.android.systemui.settings.BrightnessDialog,performPause]
01-01 12:12:46.133972 1075 8348 I am_finish_activity: [0,225503206,13,com.android.systemui/.settings.BrightnessDialog,app-request]

从这里看到BrightnessDialog既走了pause流程,又走了finish流程,这里比较奇怪(问题先留着),从finish到发生ANR正好是input ANR的时间

先看下为何会走pause流程,启动了fruit游戏的activity

01-01 12:12:46.013258 1075 1197 I am_proc_start: [0,11030,10127,free.fruits.frolic.game.shalltry,activity,free.fruits.frolic.game.shalltry/com.LLK.FruitsLLK.UnityMain]
01-01 12:12:46.047620 1075 9116 I am_restart_activity: [0,56893191,14,free.fruits.frolic.game.shalltry/com.LLK.FruitsLLK.UnityMain]
01-01 12:12:46.050602 1075 9116 I am_set_resumed_activity: [0,free.fruits.frolic.game.shalltry/com.LLK.FruitsLLK.UnityMain,minimalResumeActivityLocked]

01-01 12:12:46.198058 1075 9116 I am_finish_activity: [0,56893191,14,free.fruits.frolic.game.shalltry/com.LLK.FruitsLLK.UnityMain,app-request]
01-01 12:12:46.201397 11030 11030 I am_on_create_called: [0,com.LLK.FruitsLLK.UnityMain,performCreate]

01-01 12:12:55.878632 1075 1147 I am_destroy_activity: [0,56893191,14,free.fruits.frolic.game.shalltry/com.LLK.FruitsLLK.UnityMain,finish-imm:activityIdleInternalLocked]
01-01 12:12:56.061931 11030 11030 I am_on_destroy_called: [0,com.LLK.FruitsLLK.UnityMain,performDestroy]

这个Activity(com.LLK.FruitsLLK.UnityMain)只走了onCreate方法,就finish掉了,说明这就是过渡界面(不会resume),作用就是启动其他Activity,可以看如下log

01-01 12:12:46.183829 1075 3522 I am_create_activity: [0,22823027,14,free.fruits.frolic.game.shalltry/com.LLK.FruitsLLK.UnityPlayerNativeActivity,NULL,NULL,NULL,268435456]
01-01 12:12:46.220914 1075 3522 I am_restart_activity: [0,22823027,14,free.fruits.frolic.game.shalltry/com.LLK.FruitsLLK.UnityPlayerNativeActivity]
01-01 12:12:46.223999 1075 3522 I am_set_resumed_activity: [0,free.fruits.frolic.game.shalltry/com.LLK.FruitsLLK.UnityPlayerNativeActivity,minimalResumeActivityLocked]

01-01 12:12:46.831773 11030 11030 I am_on_create_called: [0,com.LLK.FruitsLLK.UnityPlayerNativeActivity,performCreate]
01-01 12:12:46.833919 11030 11030 I am_on_start_called: [0,com.LLK.FruitsLLK.UnityPlayerNativeActivity,handleStartActivity]
01-01 12:12:46.835982 11030 11030 I am_on_resume_called: [0,com.LLK.FruitsLLK.UnityPlayerNativeActivity,RESUME_ACTIVITY]

到目前好像就是3个Activity的交互,为何会发生ANR呢

先提3个疑问

BrightnessDialog finish流程是怎么调到的
BrightnessDialog的Activity为何没有之后的流程(stop,destory)
UnityPlayerNativeActivity早已经起来了,为何还会发生BrightnessDialog的ANR
 

接下来就一一分析下3个问题

对于第一个问题:

根据log ,reason是app-request,应用自身调用的,什么情况自身会调用finish呢

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/204130
推荐阅读
相关标签
  

闽ICP备14008679号