Added in API level 24

OnFrameMetricsAvailableListener


interface OnFrameMetricsAvailableListener
android.view.Window.OnFrameMetricsAvailableListener

Callback for clients that want frame timing information for each frame rendered by the Window.

Summary

Public methods
abstract Unit
onFrameMetricsAvailable(window: Window!, frameMetrics: FrameMetrics!, dropCountSinceLastInvocation: Int)

Called when information is available for the previously rendered frame.

Public methods

onFrameMetricsAvailable

Added in API level 24
abstract fun onFrameMetricsAvailable(
    window: Window!,
    frameMetrics: FrameMetrics!,
    dropCountSinceLastInvocation: Int
): Unit

Called when information is available for the previously rendered frame. Reports can be dropped if this callback takes too long to execute, as the report producer cannot wait for the consumer to complete. It is highly recommended that clients copy the passed in FrameMetrics via FrameMetrics.FrameMetrics(FrameMetrics) within this method and defer additional computation or storage to another thread to avoid unnecessarily dropping reports.

Parameters
window Window!: The Window on which the frame was displayed.
frameMetrics FrameMetrics!: the available metrics. This object is reused on every call and thus this reference is not valid outside the scope of this method.
dropCountSinceLastInvocation Int: the number of reports dropped since the last time this callback was invoked.