JankStats.OnFrameListener


public fun interface JankStats.OnFrameListener


This interface should be implemented to receive per-frame callbacks with jank data.

Internally, the FrameData objected passed to OnFrameListener.onFrame is reused and populated with new data on every frame. This means that listeners implementing OnFrameListener cannot depend on the data received in that structure over time and should consider the FrameData object obsolete when control returns from the listener. Clients wishing to retain data from this call should copy the data elsewhere before returning.

Summary

Public methods

abstract void
onFrame(@NonNull FrameData volatileFrameData)

The implementation of this method will be called on every frame when an OnFrameListener is set on this JankStats object.

Public methods

onFrame

Added in 1.0.0-beta01
abstract void onFrame(@NonNull FrameData volatileFrameData)

The implementation of this method will be called on every frame when an OnFrameListener is set on this JankStats object.

The FrameData object will be modified internally after returning from the listener; any data that needs to be retained should be copied before returning.

Parameters
@NonNull FrameData volatileFrameData

The data for the most recent frame.