Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/view/SurfaceControl.JankData#constants) \| [Methods](https://developer.android.com/reference/android/view/SurfaceControl.JankData#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/view/SurfaceControl.JankData#inhmethods)

# SurfaceControl.JankData

*** ** * ** ***


`
public
static


class
SurfaceControl.JankData
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.view.SurfaceControl.JankData |

<br />

*** ** * ** ***

Jank information to be fed back via `https://developer.android.com/reference/android/view/SurfaceControl.OnJankDataListener`.


Apps may register a `https://developer.android.com/reference/android/view/SurfaceControl.OnJankDataListener` to get periodic batches of jank classification
data from the
[composer](https://source.android.com/docs/core/graphics/surfaceflinger-windowmanager)
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 `https://developer.android.com/reference/android/view/FrameMetrics` API by associating jank
classification data with `https://developer.android.com/reference/android/view/FrameMetrics` data via the frame VSync id.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/view/SurfaceControl.JankData#JANK_APPLICATION` Bitmask for jank due to deadlines missed by the application. |
| `int` | `https://developer.android.com/reference/android/view/SurfaceControl.JankData#JANK_COMPOSER` Bitmask for jank due to deadlines missed by the composer. |
| `int` | `https://developer.android.com/reference/android/view/SurfaceControl.JankData#JANK_NONE` No jank detected, the frame was on time. |
| `int` | `https://developer.android.com/reference/android/view/SurfaceControl.JankData#JANK_OTHER` Bitmask for jank due to deadlines missed by other system components. |
| `long` | `https://developer.android.com/reference/android/view/SurfaceControl.JankData#PRESENTATION_TIME_UNKNOWN` The presentation time is unknown. |
| `long` | `https://developer.android.com/reference/android/view/SurfaceControl.JankData#PRESENTATION_TIME_UNSET` The presentation time is unset. |

| ### Public methods ||
|---|---|
| ` long` | ` https://developer.android.com/reference/android/view/SurfaceControl.JankData#getActualAppFrameTimeNanos()() ` Returns the actual time in nanoseconds taken by the application to render this frame. |
| ` long` | ` https://developer.android.com/reference/android/view/SurfaceControl.JankData#getDesiredPresentTimeNanos()() ` Returns the time in nanoseconds the frame was intended to be presented, such as the one set by `https://developer.android.com/`. |
| ` int` | ` https://developer.android.com/reference/android/view/SurfaceControl.JankData#getJankType()() ` Returns the bitmask indicating the types of jank observed. |
| ` long` | ` https://developer.android.com/reference/android/view/SurfaceControl.JankData#getPresentTimeNanos()() ` Returns the time in nanoseconds the frame was actually presented. |
| ` long` | ` https://developer.android.com/reference/android/view/SurfaceControl.JankData#getScheduledAppFrameTimeNanos()() ` Returns the duration in nanoseconds the application was scheduled to use to render this frame. |
| ` long` | ` https://developer.android.com/reference/android/view/SurfaceControl.JankData#getVsyncId()() ` Returns the id of the frame for this jank classification. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/view/SurfaceControl.JankData#toString()() ` Returns a string representation of the object. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Constants

### JANK_APPLICATION

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int JANK_APPLICATION
```

Bitmask for jank due to deadlines missed by the application.

<br />

Constant Value:

2
(0x00000002)


### JANK_COMPOSER

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int JANK_COMPOSER
```

Bitmask for jank due to deadlines missed by the composer.

<br />

Constant Value:

1
(0x00000001)


### JANK_NONE

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int JANK_NONE
```

No jank detected, the frame was on time.

<br />

Constant Value:

0
(0x00000000)


### JANK_OTHER

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int JANK_OTHER
```

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

<br />

Constant Value:

4
(0x00000004)


### PRESENTATION_TIME_UNKNOWN

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final long PRESENTATION_TIME_UNKNOWN
```

The presentation time is unknown.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/SurfaceControl.JankData#getPresentTimeNanos()`

Constant Value:

-1
(0xffffffffffffffff)


### PRESENTATION_TIME_UNSET

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final long PRESENTATION_TIME_UNSET
```

The presentation time is unset.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/SurfaceControl.JankData#getDesiredPresentTimeNanos()`
- `https://developer.android.com/reference/android/view/SurfaceControl.JankData#getPresentTimeNanos()`

Constant Value:

0
(0x0000000000000000)


## Public methods

### getActualAppFrameTimeNanos

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Returns ||
|---|---|
| `long` | the actual app time in ns. Value is a non-negative duration in nanoseconds. <br /> |

### getDesiredPresentTimeNanos

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public long getDesiredPresentTimeNanos ()
```

Returns the time in nanoseconds the frame was intended to be presented, such as the one
set by `https://developer.android.com/`. Will be
`https://developer.android.com/reference/android/view/SurfaceControl.JankData#PRESENTATION_TIME_UNSET` if a desired present time was not set for this frame.

<br />

| Returns ||
|---|---|
| `long` | the desired present time in ns <br /> |

### getJankType

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getJankType ()
```

Returns the bitmask indicating the types of jank observed.

<br />

| Returns ||
|---|---|
| `int` | the jank type bitmask. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/view/SurfaceControl.JankData#JANK_NONE` - `https://developer.android.com/reference/android/view/SurfaceControl.JankData#JANK_COMPOSER` - `https://developer.android.com/reference/android/view/SurfaceControl.JankData#JANK_APPLICATION` - `https://developer.android.com/reference/android/view/SurfaceControl.JankData#JANK_OTHER` |

### getPresentTimeNanos

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
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 `https://developer.android.com/reference/android/view/SurfaceControl.JankData#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 `https://developer.android.com/reference/android/view/SurfaceControl.JankData#PRESENTATION_TIME_UNKNOWN`.

<br />

| Returns ||
|---|---|
| `long` | the present time in ns <br /> |

### getScheduledAppFrameTimeNanos

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Returns ||
|---|---|
| `long` | scheduled app time in ns. Value is a non-negative duration in nanoseconds. <br /> |

### getVsyncId

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getVsyncId ()
```

Returns the id of the frame for this jank classification.

<br />

| Returns ||
|---|---|
| `long` | the frame id <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/FrameMetrics#FRAME_TIMELINE_VSYNC_ID`
- `https://developer.android.com/reference/android/view/Choreographer.FrameTimeline#getVsyncId()`
- `https://developer.android.com/reference/android/view/SurfaceControl.Transaction#setFrameTimeline(long)`

### toString

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |