Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/view/ScrollCaptureSession#pubctors) \| [Methods](https://developer.android.com/reference/android/view/ScrollCaptureSession#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/view/ScrollCaptureSession#inhmethods)

# ScrollCaptureSession

*** ** * ** ***

` public class ScrollCaptureSession `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

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

<br />

*** ** * ** ***

A session represents the scope of interaction between a `https://developer.android.com/reference/android/view/ScrollCaptureCallback` and the system during an active scroll capture operation.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/view/ScrollCaptureSession#ScrollCaptureSession(android.view.Surface,%20android.graphics.Rect,%20android.graphics.Point)(https://developer.android.com/reference/android/view/Surface surface, https://developer.android.com/reference/android/graphics/Rect scrollBounds, https://developer.android.com/reference/android/graphics/Point positionInWindow) ` Constructs a new session instance. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/graphics/Point` | ` https://developer.android.com/reference/android/view/ScrollCaptureSession#getPositionInWindow()() ` Returns the offset of `scroll bounds` within the window. |
| ` https://developer.android.com/reference/android/graphics/Rect` | ` https://developer.android.com/reference/android/view/ScrollCaptureSession#getScrollBounds()() ` Returns the `scroll bounds`, as provided by `https://developer.android.com/reference/android/view/ScrollCaptureCallback#onScrollCaptureSearch(android.os.CancellationSignal,%20java.util.function.Consumer<android.graphics.Rect>)`. |
| ` https://developer.android.com/reference/android/view/Surface` | ` https://developer.android.com/reference/android/view/ScrollCaptureSession#getSurface()() ` Returns a [BufferQueue](https://source.android.com/devices/graphics/arch-bq-gralloc) in the form of a `https://developer.android.com/reference/android/view/Surface` for transfer of image buffers. |

### 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 constructors

### ScrollCaptureSession

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

```
public ScrollCaptureSession (Surface surface, 
                Rect scrollBounds, 
                Point positionInWindow)
```

Constructs a new session instance.

<br />

| Parameters ||
|---|---|
| `surface` | `Surface`: the surface to consume generated images. This value cannot be `null`. <br /> |
| `scrollBounds` | `Rect`: the bounds of the capture area within the containing view. This value cannot be `null`. <br /> |
| `positionInWindow` | `Point`: the offset of scrollBounds within the window. This value cannot be `null`. <br /> |

## Public methods

### getPositionInWindow

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

```
public Point getPositionInWindow ()
```

Returns the offset of `scroll bounds` within the window.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Point` | the area of scrolling content within the containing view. This value cannot be `null`. <br /> |

### getScrollBounds

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

```
public Rect getScrollBounds ()
```

Returns the `scroll bounds`, as provided by `https://developer.android.com/reference/android/view/ScrollCaptureCallback#onScrollCaptureSearch(android.os.CancellationSignal,%20java.util.function.Consumer<android.graphics.Rect>)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Rect` | the area of scrolling content within the containing view. This value cannot be `null`. <br /> |

### getSurface

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

```
public Surface getSurface ()
```

Returns a [BufferQueue](https://source.android.com/devices/graphics/arch-bq-gralloc) in the form of a `https://developer.android.com/reference/android/view/Surface` for transfer of image buffers.

The surface is guaranteed to remain `https://developer.android.com/reference/android/view/Surface#isValid()` until the session `https://developer.android.com/reference/android/view/ScrollCaptureCallback#onScrollCaptureEnd(java.lang.Runnable)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/Surface` | the surface for transferring image buffers. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if the session has been closed |