SurfaceControl.JankData


public static class SurfaceControl.JankData
extends Object

java.lang.Object
   ↳ android.view.SurfaceControl.JankData


Jank information to be fed back via OnJankDataListener.

Apps may register a OnJankDataListener to get periodic batches of jank classification data from the composer regarding rendered frames. A frame is considered janky if it did not reach the display at the intended time, typically due to missing a rendering deadline. This API provides information that can be used to identify the root cause of the scheduling misses and provides overall frame scheduling statistics.

This API can be used in conjunction with the FrameMetrics API by associating jank classification data with FrameMetrics data via the frame VSync id.

Summary

Constants

int JANK_APPLICATION

Bitmask for jank due to deadlines missed by the application.

int JANK_COMPOSER

Bitmask for jank due to deadlines missed by the composer.

int JANK_NONE

No jank detected, the frame was on time.

int JANK_OTHER

Bitmask for jank due to deadlines missed by other system components.

long PRESENTATION_TIME_UNKNOWN

The presentation time is unknown.

long PRESENTATION_TIME_UNSET

The presentation time is unset.

Public methods

long getActualAppFrameTimeNanos()

Returns the actual time in nanoseconds taken by the application to render this frame.

long getDesiredPresentTimeNanos()

Returns the time in nanoseconds the frame was intended to be presented, such as the one set by ERROR(Transaction.setDesiredPresentTime/android.view.SurfaceControl.Transaction#setDesiredPresentTime Transaction.setDesiredPresentTime).

int getJankType()

Returns the bitmask indicating the types of jank observed.

long getPresentTimeNanos()

Returns the time in nanoseconds the frame was actually presented.

long getScheduledAppFrameTimeNanos()

Returns the duration in nanoseconds the application was scheduled to use to render this frame.

long getVsyncId()

Returns the id of the frame for this jank classification.

String toString()

Returns a string representation of the object.

Inherited methods

Constants

JANK_APPLICATION

Added in API level 36
public static final int JANK_APPLICATION

Bitmask for jank due to deadlines missed by the application.

Constant Value: 2 (0x00000002)

JANK_COMPOSER

Added in API level 36
public static final int JANK_COMPOSER

Bitmask for jank due to deadlines missed by the composer.

Constant Value: 1 (0x00000001)

JANK_NONE

Added in API level 36
public static final int JANK_NONE

No jank detected, the frame was on time.

Constant Value: 0 (0x00000000)

JANK_OTHER

Added in API level 36
public static final int JANK_OTHER

Bitmask for jank due to deadlines missed by other system components.

Constant Value: 4 (0x00000004)

PRESENTATION_TIME_UNKNOWN

Added in API level 10000
public static final long PRESENTATION_TIME_UNKNOWN

The presentation time is unknown.

Constant Value: -1 (0xffffffffffffffff)

PRESENTATION_TIME_UNSET

Added in API level 10000
public static final long PRESENTATION_TIME_UNSET

The presentation time is unset.

Constant Value: 0 (0x0000000000000000)

Public methods

getActualAppFrameTimeNanos

Added in API level 36
public long getActualAppFrameTimeNanos ()

Returns the actual time in nanoseconds taken by the application to render this frame.
Value is a non-negative duration in nanoseconds.

Returns
long the actual app time in ns.
Value is a non-negative duration in nanoseconds.

getDesiredPresentTimeNanos

Added in API level 10000
public long getDesiredPresentTimeNanos ()

Returns the time in nanoseconds the frame was intended to be presented, such as the one set by ERROR(Transaction.setDesiredPresentTime/android.view.SurfaceControl.Transaction#setDesiredPresentTime Transaction.setDesiredPresentTime). Will be PRESENTATION_TIME_UNSET if a desired present time was not set for this frame.

Returns
long the desired present time in ns

getJankType

Added in API level 36
public int getJankType ()

Returns the bitmask indicating the types of jank observed.

Returns
int the jank type bitmask.
Value is either 0 or a combination of the following:

getPresentTimeNanos

Added in API level 10000
public long getPresentTimeNanos ()

Returns the time in nanoseconds the frame was actually presented. If the frame was not presented (for example, if it was replaced by a new frame before being sent to the display), this value will be PRESENTATION_TIME_UNSET. If the presentation status of the frame is unknown (for example, if the device does not support display present fences), this value will be PRESENTATION_TIME_UNKNOWN.

Returns
long the present time in ns

getScheduledAppFrameTimeNanos

Added in API level 36
public long getScheduledAppFrameTimeNanos ()

Returns the duration in nanoseconds the application was scheduled to use to render this frame.

Note that this may be higher than the frame interval to allow for CPU/GPU parallelization of work.
Value is a non-negative duration in nanoseconds.

Returns
long scheduled app time in ns.
Value is a non-negative duration in nanoseconds.

getVsyncId

Added in API level 36
public long getVsyncId ()

Returns the id of the frame for this jank classification.

Returns
long the frame id

toString

Added in API level 36
public String toString ()

Returns a string representation of the object.

Returns
String a string representation of the object.