Interface

UiDispatcherTracer

Receives trace events from AndroidUiDispatcher, for tools that record how tasks and frame callbacks are queued and run.

Source set: Android
public interface UiDispatcherTracer

Receives trace events from AndroidUiDispatcher, for tools that record how tasks and frame callbacks are queued and run. Install one with AndroidUiDispatcher.setTracer.

The dispatcher may call instant and counter from any thread, since tasks reach it from arbitrary threads, and calls beginSection and endSection on its own thread. It calls all of them once per dispatched task, so implementations should not be expensive.

Event names, counter names and flow IDs reflect the dispatcher's internal behavior and may change between releases.

Functions

instant

Source set: Android
public fun instant(name: String, flowIds: LongList)

Emits an instant event named name, associated with flowIds.

beginSection

Source set: Android
public fun beginSection(name: String, flowIds: LongList)

Begins a trace section named name, associated with flowIds. Match this with a corresponding endSection on the same thread.

endSection

Source set: Android
public fun endSection()

Ends the trace section that beginSection most recently started on this thread.

counter

Source set: Android
public fun counter(name: String, value: Long)

Records value for the counter track named name.

isEnabled

Source set: Android
public fun isEnabled(): Boolean

Returns true if tracing is currently active.

The dispatcher calls this before doing any work to build trace arguments, so it should not be expensive.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: