当前位置:网站首页>如何添加 logs来debug ANR 问题
如何添加 logs来debug ANR 问题
2022-06-28 20:19:00 【专业开发者】
通常,如果应用程序不能响应用户输入,系统将显示ANR对话框。 应用程序响应是由活动管理器服务监控的。当Android检测到以下条件之一时,将显示一个特定应用程序的ANR对话框:
1. 5秒内没有响应输入事件(如按键或触屏事件)。
2. BroadcastReceiver在10秒内没有完成执行(后台广播为60秒)。
3. 启动服务的操作在20秒内未执行完成(后台服务为200秒)
添加logs
1.为了调试输入相关的ANR问题,
In InputDispatcher.cpp,
请在上面加上下面一行
#define LOG_NDEBUG 0
并且,请启用DEBUG_FOCUS和DEBUG_DISPATCH_CYCLE
#define DEBUG_DISPATCH_CYCLE 1
#define DEBUG_FOCUS 1
并且,请在其中添加一些调试日志,打印等待开始时间、等待超时时间和当前时间,如下黄色标记代码:
985int32_t InputDispatcher::handleTargetsNotReadyLocked(nsecs_t currentTime,
986 const EventEntry* entry,
987 const sp<InputApplicationHandle>& applicationHandle,
988 const sp<InputWindowHandle>& windowHandle,
989 nsecs_t* nextWakeupTime, const char* reason) {
……
+ #if DEBUG_FOCUS
+ ALOG
边栏推荐
猜你喜欢

ThreadLocal principle

【Go语言刷题篇】Go从0到入门5:Map综合复习、条件语句、循环语句练习
![[learning notes] Introduction to principal component analysis](/img/24/a760d1cd095a967ef258b623eb465c.png)
[learning notes] Introduction to principal component analysis
oracle delete误删除表数据后如何恢复

How to obtain the coordinates of the aircraft passing through both ends of the radar

电子科大(申恒涛团队)&京东AI(梅涛团队)提出用于视频问答的结构化双流注意网络,性能SOTA!优于基于双视频表示的方法!...

2022 welder (elementary) special operation certificate examination question bank and answers

How strong a mathematical foundation does deep learning need?

Leetcode week 299

C # connect to the database to complete the operation of adding, deleting, modifying and querying
随机推荐
Data standardization processing
Pipeline | and redirection >
Severity code description project file line suppress status error lnk2038 detected a mismatch of "runtimelibrary": the value "md\u dynamicrelease" does not match the value "mdd\u dynamicde"
Can layoffs really save China's Internet?
internship:术语了解及着手写接口
【学习笔记】主成分分析法介绍
方 差 分 析
【Try to Hack】Cobalt Strike(一)
Markdown mermaid种草(1)_ mermaid简介
【算法篇】刷了两道大厂面试题,含泪 ”重学数组“
员工薪资管理系统
with torch.no_grad():的使用原因
ComparisonChain-文件名排序
Use of WC command
522. longest special sequence II (greedy & double pointer)
T检验(检验两个总体的均值差异是否显著)
2837. The total number of teams
Visualization of neural network structure in different frames
输入和输出字符型数据
Windows 64 bit download install my SQL