App startup
From tapping the icon to the first frame
Startup is the work between a launch request and a usable screen. Time to initial display (TTID) measures the first frame; time to full display (TTFD) describes readiness reported by the app. A fast first frame can still hide a slow data load. App startup time.
Three types of startup
- Cold: process and Activity initialization are needed.
- Warm: some work must be repeated; a common case is a live process with a recreated Activity. Android's guide also discusses restoration using saved state after eviction, so record the actual measurement conditions.
- Hot: an existing Activity returns to the foreground with less initialization. Startup states.
A process comes from Zygote, possibly through the pre-forked USAP pool. Therefore, a launch request does not always cause a new fork at that instant. The app process can also start for a non-UI component. Zygote, Application.onCreate.
Investigating a slow first frame
Use repeated Macrobenchmark runs and inspect the trace. Check initialization, main-thread I/O and first-screen work before choosing an optimization. StartupTimingMetric distinguishes initial display from full display; the latter needs a correctly placed reportFullyDrawn. Metrics.
Content providers installed during ordinary process startup can initialize before Application.onCreate. This makes provider-based SDK initialization part of the startup cost; direct boot affects which components are available. Application contract, App Startup.