# FrameData

Artifact: [androidx.metrics:metrics-performance](https://developer.android.com/jetpack/androidx/releases/metrics) [View Source](https://cs.android.com/search?q=file:androidx/metrics/performance/FrameData.kt+class:androidx.metrics.performance.FrameData) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/metrics#1.0.0)

*** ** * ** ***


```
public class FrameData
```

<br />

Known direct subclasses [FrameDataApi24](https://developer.android.com/reference/androidx/metrics/performance/FrameDataApi24)

|---|---|
| `https://developer.android.com/reference/androidx/metrics/performance/FrameDataApi24` | This class stores duration data for a single frame. |

Known indirect subclasses [FrameDataApi31](https://developer.android.com/reference/androidx/metrics/performance/FrameDataApi31)

|---|---|
| `https://developer.android.com/reference/androidx/metrics/performance/FrameDataApi31` | This class stores duration data for a single frame. |

*** ** * ** ***

This class stores duration data for a single frame.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/metrics/performance/JankStats#jankHeuristicMultiplier()` |   |
| `https://developer.android.com/reference/androidx/metrics/performance/PerformanceMetricsState#putState(kotlin.String,kotlin.String)` |   |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/metrics/performance/FrameData#FrameData(kotlin.Long,kotlin.Long,kotlin.Boolean,kotlin.collections.List)( long frameStartNanos, long frameDurationUiNanos, boolean isJank, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/metrics/performance/StateInfo> states )` |

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/metrics/performance/FrameData` | `https://developer.android.com/reference/androidx/metrics/performance/FrameData#copy()()` Utility method which makes a copy of the items in this object (including copying the items in `states` into a new List). |
| `boolean` | `https://developer.android.com/reference/androidx/metrics/performance/FrameData#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final long` | `https://developer.android.com/reference/androidx/metrics/performance/FrameData#getFrameDurationUiNanos()()` The time spent in the UI portion of this frame (in nanoseconds). |
| `final long` | `https://developer.android.com/reference/androidx/metrics/performance/FrameData#getFrameStartNanos()()` These backing fields are used to enable mutation of an existing FrameData object, to avoid allocating a new object on every frame for sending out to listeners. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/metrics/performance/StateInfo>` | `https://developer.android.com/reference/androidx/metrics/performance/FrameData#getStates()()` The UI/app state during this frame. |
| `int` | `https://developer.android.com/reference/androidx/metrics/performance/FrameData#hashCode()()` |
| `final boolean` | `https://developer.android.com/reference/androidx/metrics/performance/FrameData#isJank()()` Whether this frame was determined to be janky, meaning that its duration exceeds the duration determined by the system to indicate jank (@see `https://developer.android.com/reference/androidx/metrics/performance/JankStats#jankHeuristicMultiplier()`). |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/metrics/performance/FrameData#toString()()` |

## Public constructors

### FrameData

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/metrics#1.0.0)

```
public FrameData(
    long frameStartNanos,
    long frameDurationUiNanos,
    boolean isJank,
    @NonNull List<@NonNull StateInfo> states
)
```

## Public methods

### copy

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/metrics#1.0.0)

```
public @NonNull FrameData copy()
```

Utility method which makes a copy of the items in this object (including copying the items in `states` into a new List). This is used internally to create a copy to pass along to listeners to avoid having a reference to the internally-mutable FrameData object.

### equals

```
public boolean equals(Object other)
```

### getFrameDurationUiNanos

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/metrics#1.0.0)

```
public final long getFrameDurationUiNanos()
```

The time spent in the UI portion of this frame (in nanoseconds). This is essentially the time spent on the UI thread to draw this frame, but does not include any time spent on the RenderThread.

### getFrameStartNanos

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/metrics#1.0.0)

```
public final long getFrameStartNanos()
```

These backing fields are used to enable mutation of an existing FrameData object, to avoid allocating a new object on every frame for sending out to listeners.

### getStates

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/metrics#1.0.0)

```
public final @NonNull List<@NonNull StateInfo> getStates()
```

The UI/app state during this frame. This is the information set by the app, or by other library code, that can be analyzed later to determine the UI state that was current when jank occurred.

### hashCode

```
public int hashCode()
```

### isJank

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/metrics#1.0.0)

```
public final boolean isJank()
```

Whether this frame was determined to be janky, meaning that its duration exceeds the duration determined by the system to indicate jank (@see `https://developer.android.com/reference/androidx/metrics/performance/JankStats#jankHeuristicMultiplier()`).

### toString

```
public @NonNull String toString()
```