Jank & Rendering Quiz
PERFORMANCE › Runtime
What is the approximate per-frame time budget to sustain 60fps?
- 8ms
- 11ms
- 16ms
- 33ms
Answer: 16ms
60fps means a new frame every 1000/60 ms, so each frame's work must complete in about 16ms; 8ms corresponds to 120fps and 11ms to 90fps.
Which thread actually executes the GPU draw commands (DrawFrame) for a frame?
- RenderThread
- The main/UI thread
- HeapTaskDaemon
- A Binder thread
Answer: RenderThread
The UI thread records drawing into a display list, but RenderThread performs DrawFrame: syncing, texture upload, and issuing GPU draw calls.
In Android vitals, an app is flagged for slow rendering when roughly what share of its frames take longer than 16ms?
- 1%
- 5%
- 10%
- 25%
Answer: 25%
The slow-rendering bad-behavior bar is about 25% of frames exceeding 16ms; the separate frozen-frames bar is about 0.1% of frames exceeding 700ms.
What does the Debug GPU Overdraw overlay in Developer Options visualize?
- The current rendering rate measured in frames per second
- How many times each pixel was drawn in a single frame
- The GPU chip's temperature while the app is running
- The amount of memory allocated for each rendered frame
Answer: How many times each pixel was drawn in a single frame
Debug GPU Overdraw color-codes pixels by how many times they were drawn in a frame (true color/blue is 1x, red is 4x+), highlighting wasted fill rate.
Which tool is the best fit for catching frame-timing regressions on real UI interactions in CI?
- Macrobenchmark with FrameTimingMetric on a real device
- Lint for static code checks, not UI frame timing issues
- Layout Inspector for viewing views, not CI regressions
- StrictMode for spotting bad app work, not frame timing
Answer: Macrobenchmark with FrameTimingMetric on a real device
Macrobenchmark runs scripted interactions on a physical device against a release-like build and reports frame-duration percentiles, making it suited to automated regression tracking.
Scroll jank traces to excessive Compose recomposition. Which is the most effective fix?
- Call the adapter's notifyDataSetChanged() far less frequently
- Move the Compose composition pass onto a background thread
- Raise the display's per-frame render budget from 16ms up to 33ms
- Use stable types and defer state reads via remember/derivedStateOf
Answer: Use stable types and defer state reads via remember/derivedStateOf
Reducing recomposition relies on stability and scoping/deferring state reads; notifyDataSetChanged is a View/RecyclerView API, composition must run on the main thread, and you cannot raise the display's frame budget.
An app's main thread is blocked for about 6 seconds. What does the Android system report?
- A single dropped frame from a brief rendering stall
- An ANR (Application Not Responding) event
- A frozen frame from a 700ms-to-5s UI stall
- Excessive overdraw from too many overlapping views
Answer: An ANR (Application Not Responding) event
Main-thread unresponsiveness of roughly 5s or more triggers an ANR; frozen frames are the 700ms to 5s range, and dropped frames are sub-5s rendering stalls.
Which component schedules UI work to align with the display's VSYNC signal and drives the per-frame callback that runs input, animation, measure, layout, and draw?
- WindowManager
- Choreographer
- SurfaceFlinger
- HandlerThread
Answer: Choreographer
Choreographer receives the VSYNC pulse and posts the frame callback that runs the UI-thread work for each frame; SurfaceFlinger is the system compositor and WindowManager/HandlerThread are unrelated to per-frame scheduling.
You want to attribute real-user jank to specific screens or UI states in production. Which AndroidX library is purpose-built for that?
- Macrobenchmark
- Profile GPU Rendering
- Systrace
- JankStats
Answer: JankStats
JankStats is the AndroidX library for field/production jank monitoring, reporting per-frame FrameData with attached UI state; Macrobenchmark and the others are lab/profiling tools, not in-production reporters.
Above what render duration does Android vitals classify a frame as a frozen frame?
- 16ms
- 100ms
- 700ms
- 5000ms
Answer: 700ms
Frozen frames are those taking longer than 700ms; 16ms is the slow-frame line and ~5000ms is the ANR territory for a blocked main thread.
Which developer tool helps you automatically catch accidental disk or network reads happening on the main thread during development?
- StrictMode
- Layout Inspector
- JankStats
- Baseline Profiles
Answer: StrictMode
StrictMode's thread policy detects main-thread disk and network access (and other violations) and can log or crash on them; the others do not flag main-thread I/O.
A composable reads a frequently-changing scroll offset to compute a boolean (e.g., whether to show a 'scroll to top' button), causing recomposition on every scroll pixel. Which API best limits recomposition to only when the boolean actually flips?
- LaunchedEffect
- derivedStateOf
- rememberCoroutineScope
- produceState
Answer: derivedStateOf
derivedStateOf creates a derived state that only triggers downstream recomposition when its computed result changes, not on every read of the rapidly-changing source state.
During fast scrolling an app allocates many short-lived objects each frame and stutters intermittently. What is the most likely mechanism behind the jank?
- The RenderThread runs out of memory and restarts unexpectedly
- Allocations directly slow GPU rasterization during scrolling
- SurfaceFlinger discards the swap buffer and forces redraws
- Garbage-collection pauses on the main thread eat frame time
Answer: Garbage-collection pauses on the main thread eat frame time
Heavy per-frame allocation pressure provokes garbage collection whose pauses can run on or block the main thread, eating into the frame budget; allocations do not directly affect GPU rasterization or SurfaceFlinger.
Why does shipping a Baseline Profile reduce jank, particularly during the first runs after a fresh install or update?
- It AOT-compiles hot startup and scroll paths to skip runtime JIT costs
- It raises the display refresh rate to leave more time per frame
- It moves view drawing onto a second RenderThread for smoother UI
- It disables garbage collection while the app is scrolling to avoid pauses
Answer: It AOT-compiles hot startup and scroll paths to skip runtime JIT costs
A Baseline Profile guides AOT compilation of the listed hot methods at install time, so critical paths run as optimized native code instead of being interpreted/JIT-compiled on first use, cutting first-run jank.