Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest#inhmethods)

# HardwareRenderer.FrameRenderRequest

*** ** * ** ***

` public final class HardwareRenderer.FrameRenderRequest `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.graphics.HardwareRenderer.FrameRenderRequest |

<br />

*** ** * ** ***

Sets the parameters that can be used to control a render request for a `https://developer.android.com/reference/android/graphics/HardwareRenderer`. This is not thread-safe and must not be held on to for longer than a single frame request.

## Summary

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest` | ` https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest#setFrameCommitCallback(java.util.concurrent.Executor,%20java.lang.Runnable)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/java/lang/Runnable frameCommitCallback) ` Adds a frame commit callback. |
| ` https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest` | ` https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest#setVsyncTime(long)(long vsyncTime) ` Sets the vsync time that represents the start point of this frame. |
| ` https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest` | ` https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest#setWaitForPresent(boolean)(boolean shouldWait) ` Sets whether or not `https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest#syncAndDraw()` should block until the frame has been presented. |
| ` int` | ` https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest#syncAndDraw()() ` Syncs the RenderNode tree to the render thread and requests a frame to be drawn. |

### 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*.

## Public methods

### setFrameCommitCallback

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

```
public HardwareRenderer.FrameRenderRequest setFrameCommitCallback (Executor executor, 
                Runnable frameCommitCallback)
```

Adds a frame commit callback. This callback will be invoked when the current rendering content has been rendered into a frame and submitted to the swap chain. The frame may not currently be visible on the display when this is invoked, but it has been submitted. This callback is useful in combination with `https://developer.android.com/reference/android/view/PixelCopy` to capture the current rendered content of the UI reliably.

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: The executor to run the callback on. It is strongly recommended that this executor post to a different thread, as the calling thread is highly sensitive to being blocked. This value cannot be `null`. <br /> |
| `frameCommitCallback` | `Runnable`: The callback to invoke when the frame content has been drawn. Will be invoked on the given `https://developer.android.com/reference/java/util/concurrent/Executor`. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest` | this instance. This value cannot be `null`. <br /> |

### setVsyncTime

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

```
public HardwareRenderer.FrameRenderRequest setVsyncTime (long vsyncTime)
```

Sets the vsync time that represents the start point of this frame. Typically this comes from `https://developer.android.com/reference/android/view/Choreographer.FrameCallback`. Other compatible time sources include `https://developer.android.com/reference/java/lang/System#nanoTime()`, however if the result is being displayed on-screen then using `https://developer.android.com/reference/android/view/Choreographer` is strongly recommended to ensure smooth animations.

If the clock source is not from a CLOCK_MONOTONIC source then any animations driven directly by RenderThread will not be synchronized properly with the current frame.

<br />

| Parameters ||
|---|---|
| `vsyncTime` | `long`: The vsync timestamp for this frame. The timestamp is in nanoseconds and should come from a CLOCK_MONOTONIC source. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest` | this instance. This value cannot be `null`. <br /> |

### setWaitForPresent

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

```
public HardwareRenderer.FrameRenderRequest setWaitForPresent (boolean shouldWait)
```

Sets whether or not `https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest#syncAndDraw()` should block until the frame has been presented. If this is true and `https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest#syncAndDraw()` does not return `https://developer.android.com/reference/android/graphics/HardwareRenderer#SYNC_FRAME_DROPPED` or an error then when `https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest#syncAndDraw()` has returned the frame has been submitted to the `https://developer.android.com/reference/android/view/Surface`. The default and typically recommended value is false, as blocking for present will prevent pipelining from happening, reducing overall throughput. This is useful for situations such as `https://developer.android.com/reference/android/view/SurfaceHolder.Callback2#surfaceRedrawNeeded(android.view.SurfaceHolder)` where it is desired to block until a frame has been presented to ensure first-frame consistency with other Surfaces.

<br />

| Parameters ||
|---|---|
| `shouldWait` | `boolean`: If true the next call to `https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest#syncAndDraw()` will block until completion. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest` | this instance. This value cannot be `null`. <br /> |

### syncAndDraw

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

```
public int syncAndDraw ()
```

Syncs the RenderNode tree to the render thread and requests a frame to be drawn. This `https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest` instance should no longer be used after calling this method. The system internally may reuse instances of `https://developer.android.com/reference/android/graphics/HardwareRenderer.FrameRenderRequest` to reduce allocation churn.

<br />

| Returns ||
|---|---|
| `int` | The result of the sync operation. Value is one of the following: - `https://developer.android.com/reference/android/graphics/HardwareRenderer#SYNC_OK` - `https://developer.android.com/reference/android/graphics/HardwareRenderer#SYNC_REDRAW_REQUESTED` - `https://developer.android.com/reference/android/graphics/HardwareRenderer#SYNC_LOST_SURFACE_REWARD_IF_FOUND` - `https://developer.android.com/reference/android/graphics/HardwareRenderer#SYNC_CONTEXT_IS_STOPPED` - `https://developer.android.com/reference/android/graphics/HardwareRenderer#SYNC_FRAME_DROPPED` |