跳到主要內容

發表文章

目前顯示的是有「ANR」標籤的文章

Android ANR 與原生崩潰拆解:InputDispatcher、Watchdog 到 Tombstone / Android ANR & Native Crash Debugging: From InputDispatcher and Watchdog to Linux Signals and Tombstones

daily-tech:2026-12-05 現象: 上一篇我們把 Android 從 Linux 核心、 init 、 Zygote 到 SystemServer 的開機啟動鏈一路攤平;今天接著看系統進入日常運作後,工程師最常面對的兩種「現場凍住或瞬間退場」情境。你可能遇過這樣的畫面:手指在 App 上連點了幾下毫無反應,過幾秒跳出「應用程式沒有回應」(ANR, Application Not Responding);更棘手一點,整個畫面突然黑屏並直接退回開機動畫,卻沒有重跑硬體開機商標;又或者呼叫 C/C++ 原生函式庫(例如影像編解碼或端側推論引擎)的瞬間,App 連個 Java 例外都沒留下就直接閃退。 Symptom: In our previous post, we traced the Android boot chain from the Linux kernel through init , Zygote , and SystemServer . Today we examine what happens once the system is up and something freezes or vanishes. You have likely seen an app ignore taps for several seconds before popping up an "Application Not Responding" (ANR) dialog, or watched the entire UI cut back to the boot animation without a full hardware reboot, or seen an app vanish instantly while running C/C++ native code (such as media codecs or an edge inference engine) without throwing a Java exception. 這三種表面現象背後其實對應著三條截然不同的監控與崩潰機制:前景應用程式卡住走的是 InputDispatcher 逾時與 ANR 轉儲路徑 ;整機退回開機動畫通常是 SystemSe...