Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AmolPardeshi99/android-performance-skills/llms.txt

Use this file to discover all available pages before exploring further.

The ANR & Jank Prevention skill teaches your AI coding agent the patterns that prevent Application Not Responding errors and dropped frames. It covers the full spectrum from coroutine dispatcher misuse to Compose recomposition bugs.

ANR thresholds

Android enforces hard timeouts on your app’s ability to service system-dispatched events. Exceeding any of these limits triggers an ANR. OEM firmware may use tighter values than the AOSP defaults shown here.
TriggerTimeout
Input dispatch (touch, key) blocked5 seconds
BroadcastReceiver.onReceive10 s (foreground) / 60 s (background)
Service onCreate / onStartCommand / onBind~20 seconds
JobService.onStartJob / onStopJob (Android 14+, explicit ANR)few seconds
startForegroundService without calling startForeground5 s (Android 8–14) / 3 s (Android 15+)

Frame and frozen frame thresholds

Any frame taking longer than 16 ms (at 60 fps) causes jank visible to the user. Frames exceeding 700 ms are classified as “frozen frames” and are tracked separately in Android Vitals as a distinct metric from regular jank.

Android Vitals ANR rate

Google Play surfaces the user-perceived ANR rate (Input ANRs only) in Android Vitals. Your app crosses the bad behavior threshold at ≥ 0.47% of daily active users experiencing an ANR. Staying below this threshold is required to maintain Play Store ranking and eligibility for featuring.

Topics in this group

ANR System Design

How Android’s ANR mechanism works — the bomb-planting model, three ANR types, and circuit-breaker sequence.

Coroutine Dispatchers

Choosing the right dispatcher and avoiding thread-pool starvation from blocking I/O on Dispatchers.Default.

Locks & Synchronization

Preventing deadlocks and priority inversion caused by synchronized blocks and Mutex misuse.

Cooperative Cancellation

Writing coroutines that respond to cancellation quickly and avoid leaking work after scope teardown.

Binder IPC

Safely calling system services like PackageManager, ContentResolver, and AccountManager off the main thread.

Broadcast Receivers

Completing onReceive within the 10-second foreground limit and delegating long work correctly.

Services & Jobs

Keeping onCreate, onStartCommand, and JobService callbacks non-blocking and timeout-safe.

SharedPreferences

Avoiding synchronous commits and main-thread reads that block for disk I/O.

View System

Keeping onDraw, onMeasure, and onLayout fast in custom Views and RecyclerView adapters.

Jetpack Compose

Preventing excessive recomposition from unstable state, missing remember, and skipped stability inference.

ANR Analysis

Reading ANR trace files, interpreting thread stacks, and distinguishing app-side from system-induced ANRs.

Guardrails & Detection

StrictMode policies, Perfetto tracing, and automated checks for catching violations before production.

Build docs developers (and LLMs) love