{"id":960,"date":"2023-03-11T19:38:16","date_gmt":"2023-03-11T11:38:16","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=960"},"modified":"2023-04-29T13:29:46","modified_gmt":"2023-04-29T05:29:46","slug":"definition-of-android-anr-timeout-time","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/11\/definition-of-android-anr-timeout-time\/","title":{"rendered":"Android ANR\u8d85\u65f6\u65f6\u95f4\u7684\u5b9a\u4e49"},"content":{"rendered":"<p>ANR\u8d85\u65f6\u65f6\u95f4\u5728<code>ActivityManagerService.java<\/code>\u6587\u4ef6\u4e2d\u8fdb\u884c\u4e86\u5b9a\u4e49<\/p>\n<h3>Broadcast\u8d85\u65f6\u65f6\u95f4\u4e3a10\u79d2<\/h3>\n<p><!-- more --><\/p>\n<pre><code class=\"language-java\">\/\/ How long we allow a receiver to run before giving up on it.\nstatic final int BROADCAST_FG_TIMEOUT = 10*1000;\nstatic final int BROADCAST_BG_TIMEOUT = 60*1000;<\/code><\/pre>\n<h3>\u6309\u952e\u65e0\u54cd\u5e94\u7684\u8d85\u65f6\u65f6\u95f4\u4e3a5\u79d2<\/h3>\n<pre><code class=\"language-java\">\/\/ How long we wait until we timeout on key dispatching.\nstatic final int KEY_DISPATCHING_TIMEOUT = 5*1000;<\/code><\/pre>\n<pre><code class=\"language-java\">\/\/ How long we wait until we timeout on key dispatching during instrumentation.\n static final int INSTRUMENTATION_KEY_DISPATCHING_TIMEOUT = 60*1000;<\/code><\/pre>\n<h3>Service ANR\u8d85\u65f6\u7684\u5b9a\u4e49\u5728<code>ActiveServices.java<\/code>\u4e2d<\/h3>\n<p>\u524d\u53f0Service\u65e0\u54cd\u5e94\u7684\u8d85\u65f6\u65f6\u95f4\u4e3a20\u79d2\uff0c\u540e\u53f0Service\u4e3a200\u79d2<\/p>\n<pre><code class=\"language-java\">\/\/ How long we wait for a service to finish executing.\nstatic final int SERVICE_TIMEOUT = 20*1000;\n\n\/\/ How long we wait for a service to finish executing.\nstatic final int SERVICE_BACKGROUND_TIMEOUT = SERVICE_TIMEOUT * 10;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>ANR\u8d85\u65f6\u65f6\u95f4\u5728ActivityManagerService.java\u6587\u4ef6\u4e2d\u8fdb\u884c\u4e86\u5b9a\u4e49 Broadcast\u8d85\u65f6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[213],"tags":[261],"class_list":["post-960","post","type-post","status-publish","format-standard","hentry","category-android-performance","tag-anr"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/960","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=960"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/960\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}