Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#constants) \| [Inherited Constants](https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#inhconstants) \| [Fields](https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#lfields) \| [Ctors](https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#pubctors) \| [Methods](https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#inhmethods)

# OutputConfiguration

*** ** * ** ***


`
public

final

class
OutputConfiguration
`


`

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


`

`


implements

https://developer.android.com/reference/android/os/Parcelable


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.hardware.camera2.params.OutputConfiguration |

<br />

*** ** * ** ***

A class for describing camera output, which contains a `https://developer.android.com/reference/android/view/Surface` and its specific
configuration for creating capture session.

There are several ways to instantiate, modify and use OutputConfigurations. The most common
and recommended usage patterns are summarized in the following list:

- Passing a `https://developer.android.com/reference/android/view/Surface` to the constructor and using the OutputConfiguration instance as argument to `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)`. This is the most frequent usage and clients should consider it first before other more complicated alternatives.
- Passing only a surface source class as an argument to the constructor. This is usually followed by a call to create a capture session (see `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)` and a `https://developer.android.com/reference/android/view/Surface` add call `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)` with a valid `https://developer.android.com/reference/android/view/Surface`. The sequence completes with `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#finalizeOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)`. This is the deferred usage case which aims to enhance performance by allowing the resource-intensive capture session create call to execute in parallel with any `https://developer.android.com/reference/android/view/Surface` initialization, such as waiting for a `https://developer.android.com/reference/android/view/SurfaceView` to be ready as part of the UI initialization.
- The third and most complex usage pattern involves surface sharing. Once instantiated an OutputConfiguration can be enabled for surface sharing via `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#enableSurfaceSharing()`. This must be done before creating a new capture session and enables calls to `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration)`. An OutputConfiguration with enabled surface sharing can be modified via `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)` or `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#removeSurface(android.view.Surface)`. The updates to this OutputConfiguration will only come into effect after `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration)` returns without throwing exceptions. Such updates can be done as long as the session is active. Clients should always consider the additional requirements and limitations placed on the output surfaces (for more details see `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#enableSurfaceSharing()`, `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`, `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#removeSurface(android.view.Surface)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration)`). A trade-off exists between additional complexity and flexibility. If exercised correctly surface sharing can switch between different output surfaces without interrupting any ongoing repeating capture requests. This saves time and can significantly improve the user experience.
- Surface sharing can be used in combination with deferred surfaces. The rules from both cases are combined and clients must call `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#enableSurfaceSharing()` before creating a capture session. Attach and/or remove output surfaces via `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`/`https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#removeSurface(android.view.Surface)` and finalize the configuration using `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#finalizeOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)`. `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration)` can be called after the configuration finalize method returns without exceptions.
- If the camera device supports multi-resolution output streams, `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SCALER_MULTI_RESOLUTION_STREAM_CONFIGURATION_MAP` will contain the formats and their corresponding stream info. The application can use an OutputConfiguration created with the multi-resolution stream info queried from `https://developer.android.com/reference/android/hardware/camera2/params/MultiResolutionStreamConfigurationMap#getOutputInfo(int)` and `https://developer.android.com/reference/android/hardware/camera2/MultiResolutionImageReader` to capture variable size images.

As of `https://developer.android.com/reference/android/os/Build.VERSION_CODES#P`, all formats except
`https://developer.android.com/reference/android/graphics/ImageFormat#JPEG` and `https://developer.android.com/reference/android/graphics/ImageFormat#RAW_PRIVATE` can be used for sharing, subject to
device support. On prior API levels, only `https://developer.android.com/reference/android/graphics/ImageFormat#PRIVATE` format may be used.

<br />

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)`
- `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SCALER_MULTI_RESOLUTION_STREAM_CONFIGURATION_MAP`

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_AUTO` Automatic mirroring based on camera facing This is the default mirroring mode for the camera device. |
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_H` Camera output is mirrored horizontally The camera output is mirrored horizontally, the same behavior as in AUTO mode for front facing camera. |
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_NONE` No mirror transform is applied No mirroring is applied to the camera output regardless of the camera facing. |
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_V` Camera output is mirrored vertically |
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#SURFACE_GROUP_ID_NONE` Invalid surface group ID. |
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_CHOREOGRAPHER_SYNCED` Timestamp is synchronized to choreographer. |
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_DEFAULT` Default timestamp base. |
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_MONOTONIC` Timestamp base roughly the same as `https://developer.android.com/reference/android/os/SystemClock#uptimeMillis()`. |
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_REALTIME` Timestamp base roughly the same as `https://developer.android.com/reference/android/os/SystemClock#elapsedRealtime()`. |
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_SENSOR` Timestamp base of `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE`. |

### Inherited constants

From interface `https://developer.android.com/reference/android/os/Parcelable` `int` `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR`

Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that
the Parcelable object's flattened representation includes a file descriptor.


`int` `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`

Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written
is a return value, that is the result of a function such as
"`Parcelable someFunction()`",
"`void someFunction(out Parcelable)`", or
"`void someFunction(inout Parcelable)`".


| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration>` | `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#CREATOR` |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(android.util.Size,%20java.lang.Class<T>)(https://developer.android.com/reference/android/util/Size surfaceSize, https://developer.android.com/reference/java/lang/Class<T> klass) ` Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance, with desired Surface size and Surface source class. |
| ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(android.view.Surface)(https://developer.android.com/reference/android/view/Surface surface) ` Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance with a `https://developer.android.com/reference/android/view/Surface`. |
| ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(int,%20android.util.Size)(int format, https://developer.android.com/reference/android/util/Size surfaceSize) ` Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance for an `https://developer.android.com/reference/android/media/ImageReader` for a given format and size. |
| ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(int,%20android.util.Size,%20long)(int format, https://developer.android.com/reference/android/util/Size surfaceSize, long usage) ` Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance for an `https://developer.android.com/reference/android/media/ImageReader` for a given format, size, and usage flags. |
| ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(int,%20android.view.Surface)(int surfaceGroupId, https://developer.android.com/reference/android/view/Surface surface) ` Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance with a `https://developer.android.com/reference/android/view/Surface`, with a surface group ID. |
| ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(int,%20int,%20android.util.Size)(int surfaceGroupId, int format, https://developer.android.com/reference/android/util/Size surfaceSize) ` Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance for an `https://developer.android.com/reference/android/media/ImageReader` for a given surfaceGroupId, format, and size. |
| ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(int,%20int,%20android.util.Size,%20long)(int surfaceGroupId, int format, https://developer.android.com/reference/android/util/Size surfaceSize, long usage) ` Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance for an `https://developer.android.com/reference/android/media/ImageReader` for a given surface group id, format, size, and usage flags. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSensorPixelModeUsed(int)(int sensorPixelModeUsed) ` Add a sensor pixel mode that this OutputConfiguration will be used in. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)(https://developer.android.com/reference/android/view/Surface surface) ` Add a surface to this OutputConfiguration. |
| ` static https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration>` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#createInstancesForMultiResolutionOutput(java.util.Collection<android.hardware.camera2.params.MultiResolutionStreamInfo>,%20int)(https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/android/hardware/camera2/params/MultiResolutionStreamInfo> streams, int format) ` Create a list of `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instances for a `https://developer.android.com/reference/android/hardware/camera2/MultiResolutionImageReader`. |
| ` static https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration>` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#createInstancesForMultiResolutionOutput(android.hardware.camera2.MultiResolutionImageReader)(https://developer.android.com/reference/android/hardware/camera2/MultiResolutionImageReader multiResolutionImageReader) ` Create a list of `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instances for the outputs used by a `https://developer.android.com/reference/android/hardware/camera2/MultiResolutionImageReader`. |
| ` int` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#enableSurfaceSharing()() ` Enable multiple surfaces sharing the same OutputConfiguration For advanced use cases, a camera application may require more streams than the combination guaranteed by `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSession(android.hardware.camera2.params.SessionConfiguration)`. |
| ` boolean` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Check if this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` is equal to another `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`. |
| ` int` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getConfiguredFormat()() ` Get the configured format associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`. |
| ` https://developer.android.com/reference/android/util/Size` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getConfiguredSize()() ` Get the latest configured size associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`. |
| ` long` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getDynamicRangeProfile()() ` Return current dynamic range profile. |
| ` int` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getMaxSharedSurfaceCount()() ` Get the maximum supported shared `https://developer.android.com/reference/android/view/Surface` count. |
| ` int` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getMirrorMode()() ` Get the current mirroring mode If no `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setMirrorMode(android.view.Surface,%20int)` is called first, this function returns `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_AUTO`. |
| ` int` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getMirrorMode(android.view.Surface)(https://developer.android.com/reference/android/view/Surface surface) ` Get the current mirroring mode for an output surface If no `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setMirrorMode(android.view.Surface,%20int)` is called first, this function returns `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_AUTO`. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getPhysicalCameraId()() ` Get the physical camera ID associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`. |
| ` long` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getStreamUseCase()() ` Get the current stream use case If no `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setStreamUseCase(long)` is called first, this function returns `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT`. |
| ` https://developer.android.com/reference/android/view/Surface` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getSurface()() ` Get the `https://developer.android.com/reference/android/view/Surface` associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`. |
| ` int` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getSurfaceGroupId()() ` Get the surface group ID associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/view/Surface>` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getSurfaces()() ` Get the immutable list of surfaces associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`. |
| ` int` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getTimestampBase()() ` Get the current timestamp base If no `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setTimestampBase(int)` is called first, this function returns `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_DEFAULT`. |
| ` long` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getUsage()() ` Get the usage flag associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`. |
| ` int` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#hashCode()() ` Returns a hash code value for the object. |
| ` boolean` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#isReadoutTimestampEnabled()() ` Whether readout timestamp is used for this OutputConfiguration. |
| ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#makeDeferredAndRemoveSurfaces()() ` Clear any valid output surfaces and mark the configuration as deferred. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#removeSensorPixelModeUsed(int)(int sensorPixelModeUsed) ` Remove a sensor pixel mode, previously added through addSensorPixelModeUsed, from this OutputConfiguration. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#removeSurface(android.view.Surface)(https://developer.android.com/reference/android/view/Surface surface) ` Remove a surface from this OutputConfiguration. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setDynamicRangeProfile(long)(long profile) ` Set a specific device supported dynamic range profile. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setMirrorMode(int)(int mirrorMode) ` Set the mirroring mode for this output target If this function is not called, the mirroring mode for this output is `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_AUTO`, with which the camera API will mirror the output images horizontally for front facing camera. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setMirrorMode(android.view.Surface,%20int)(https://developer.android.com/reference/android/view/Surface surface, int mirrorMode) ` Set the mirroring mode for a surface belonging to this OutputConfiguration This function is identical to `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setMirrorMode(int)` if `surface` is the only surface belonging to this OutputConfiguration. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setPhysicalCameraId(java.lang.String)(https://developer.android.com/reference/java/lang/String physicalCameraId) ` Set the id of the physical camera for this OutputConfiguration In the case one logical camera is made up of multiple physical cameras, it could be desirable for the camera application to request streams from individual physical cameras. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setReadoutTimestampEnabled(boolean)(boolean on) ` Use the camera sensor's readout time for the image timestamp. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setStreamUseCase(long)(long streamUseCase) ` Set stream use case for this OutputConfiguration Stream use case is used to describe the purpose of the stream, whether it's for live preview, still image capture, video recording, or their combinations. |
| ` static void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setSurfacesForMultiResolutionOutput(java.util.Collection<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.MultiResolutionImageReader)(https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration> outputConfigurations, https://developer.android.com/reference/android/hardware/camera2/MultiResolutionImageReader multiResolutionImageReader) ` Set the OutputConfiguration surfaces corresponding to the `https://developer.android.com/reference/android/hardware/camera2/MultiResolutionImageReader`. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setTimestampBase(int)(int timestampBase) ` Set timestamp base for this output target Timestamp base describes the time domain of images from this camera output and its relationship with `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE`. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. |

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


From interface `

https://developer.android.com/reference/android/os/Parcelable

` `
abstract


int` `
https://developer.android.com/reference/android/os/Parcelable#describeContents()()
`

Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.


`
abstract


void` `
https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags)
`

Flatten this object in to a Parcel.


## Constants

### MIRROR_MODE_AUTO

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

```
public static final int MIRROR_MODE_AUTO
```

Automatic mirroring based on camera facing

This is the default mirroring mode for the camera device. With this mode,
the camera output is mirrored horizontally for front-facing cameras. There is
no mirroring for rear-facing and external cameras.

<br />

<br />

Constant Value:

0
(0x00000000)


### MIRROR_MODE_H

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

```
public static final int MIRROR_MODE_H
```

Camera output is mirrored horizontally

The camera output is mirrored horizontally, the same behavior as in AUTO mode for
front facing camera.

<br />

<br />

Constant Value:

2
(0x00000002)


### MIRROR_MODE_NONE

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

```
public static final int MIRROR_MODE_NONE
```

No mirror transform is applied

No mirroring is applied to the camera output regardless of the camera facing.

<br />

<br />

Constant Value:

1
(0x00000001)


### MIRROR_MODE_V

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

```
public static final int MIRROR_MODE_V
```

Camera output is mirrored vertically

<br />

Constant Value:

3
(0x00000003)


### SURFACE_GROUP_ID_NONE

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

```
public static final int SURFACE_GROUP_ID_NONE
```

Invalid surface group ID.

An `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` with this value indicates that the included surface
doesn't belong to any surface group.

<br />

<br />

Constant Value:

-1
(0xffffffff)


### TIMESTAMP_BASE_CHOREOGRAPHER_SYNCED

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

```
public static final int TIMESTAMP_BASE_CHOREOGRAPHER_SYNCED
```

Timestamp is synchronized to choreographer.

The timestamp of the output images are overridden with choreographer pulses from the
display subsystem for smoother display of camera frames. An output target of SurfaceView
uses this time base by default. Note that the timestamp override is done for fixed camera
frame rate only.

This timestamp base isn't applicable to SurfaceTexture targets. SurfaceTexture's
`https://developer.android.com/reference/android/graphics/SurfaceTexture#updateTexImage()` function always
uses the latest image from the camera stream. In the case of a TextureView, the image is
displayed right away.

Timestamps with this time base cannot directly match the timestamps in
`https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback#onCaptureStarted(android.hardware.camera2.CameraCaptureSession,%20android.hardware.camera2.CaptureRequest,%20long,%20long)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback#onReadoutStarted(android.hardware.camera2.CameraCaptureSession,%20android.hardware.camera2.CaptureRequest,%20long,%20long)`, or the sensor timestamps in
`https://developer.android.com/reference/android/hardware/camera2/CaptureResult`. This timestamp base shouldn't be used if the
timestamp needs to be used for audio-video synchronization.

<br />

<br />

Constant Value:

4
(0x00000004)


### TIMESTAMP_BASE_DEFAULT

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

```
public static final int TIMESTAMP_BASE_DEFAULT
```

Default timestamp base.

The camera device decides the timestamp based on the properties of the
output surface.
- For a SurfaceView output surface, the timestamp base is `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_CHOREOGRAPHER_SYNCED`. The timestamp is overridden with choreographer pulses from the display subsystem for smoother display of camera frames when the camera device runs in fixed frame rate. The timestamp is roughly in the same time base as `https://developer.android.com/reference/android/os/SystemClock#uptimeMillis()`.
- For an output surface of MediaRecorder, MediaCodec, or ImageReader with `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_VIDEO_ENCODE` usage flag, the timestamp base is `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_MONOTONIC`, which is roughly the same time base as `https://developer.android.com/reference/android/os/SystemClock#uptimeMillis()`.
- For all other cases, the timestamp base is `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_SENSOR`, the same as what's specified by `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE`.
  - For a SurfaceTexture output surface, the camera system re-spaces the delivery of output frames based on image readout intervals, reducing viewfinder jitter. The timestamps of images remain to be `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_SENSOR`.
- Note that the reduction of frame jitter for SurfaceView and SurfaceTexture comes with slight increase in photon-to-photon latency, which is the time from when photons hit the scene to when the corresponding pixels show up on the screen. If the photon-to-photon latency is more important than the smoothness of viewfinder, `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_SENSOR` should be used instead.
**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_CHOREOGRAPHER_SYNCED`
- `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_MONOTONIC`
- `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_SENSOR`
- Constant Value: 0 (0x00000000)

### TIMESTAMP_BASE_MONOTONIC

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

```
public static final int TIMESTAMP_BASE_MONOTONIC
```

Timestamp base roughly the same as `https://developer.android.com/reference/android/os/SystemClock#uptimeMillis()`.

The timestamps of the output images are monotonically increasing, and are roughly in the
same time base as `https://developer.android.com/reference/android/os/SystemClock#uptimeMillis()`. The timestamps with this
time base can be directly used for audio-video sync in video recording.

If the camera device's `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE` is
REALTIME, timestamps with this time base cannot directly match the timestamps in
`https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback#onCaptureStarted(android.hardware.camera2.CameraCaptureSession,%20android.hardware.camera2.CaptureRequest,%20long,%20long)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback#onReadoutStarted(android.hardware.camera2.CameraCaptureSession,%20android.hardware.camera2.CaptureRequest,%20long,%20long)`, or the sensor timestamps in
`https://developer.android.com/reference/android/hardware/camera2/CaptureResult`.

<br />

<br />

Constant Value:

2
(0x00000002)


### TIMESTAMP_BASE_REALTIME

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

```
public static final int TIMESTAMP_BASE_REALTIME
```

Timestamp base roughly the same as `https://developer.android.com/reference/android/os/SystemClock#elapsedRealtime()`.

The timestamps of the output images are roughly in the
same time base as `https://developer.android.com/reference/android/os/SystemClock#elapsedRealtime()`. The timestamps with this
time base cannot be directly used for audio-video sync in video recording.

If the camera device's `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE` is
UNKNOWN, timestamps with this time base cannot directly match the timestamps in
`https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback#onCaptureStarted(android.hardware.camera2.CameraCaptureSession,%20android.hardware.camera2.CaptureRequest,%20long,%20long)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback#onReadoutStarted(android.hardware.camera2.CameraCaptureSession,%20android.hardware.camera2.CaptureRequest,%20long,%20long)`, or the sensor timestamps in
`https://developer.android.com/reference/android/hardware/camera2/CaptureResult`.

If using a REALTIME timestamp base on a device that supports only
TIMESTAMP_SOURCE_UNKNOWN, the accuracy of timestamps is only what is guaranteed in the
documentation for UNKNOWN. In particular, they have no guarantees about being accurate
enough to use in fusing image data with the output of inertial sensors, for features such as
image stabilization or augmented reality.

<br />

<br />

Constant Value:

3
(0x00000003)


### TIMESTAMP_BASE_SENSOR

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

```
public static final int TIMESTAMP_BASE_SENSOR
```

Timestamp base of `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE`.

The timestamps of the output images are in the time base as specified by `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE`. The application can look up the
corresponding result metadata by matching the timestamp with a `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback#onCaptureStarted(android.hardware.camera2.CameraCaptureSession,%20android.hardware.camera2.CaptureRequest,%20long,%20long)`, or with a `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback#onReadoutStarted(android.hardware.camera2.CameraCaptureSession,%20android.hardware.camera2.CaptureRequest,%20long,%20long)` if readout timestamp is used.

<br />

<br />

Constant Value:

1
(0x00000001)


## Fields

### CREATOR

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

```
public static final Creator<OutputConfiguration> CREATOR
```

<br />

<br />

## Public constructors

### OutputConfiguration

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

```
public OutputConfiguration (Size surfaceSize, 
                Class<T> klass)
```

Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance, with desired Surface size and Surface
source class.


This constructor takes an argument for desired Surface size and the Surface source class
without providing the actual output Surface. This is used to setup an output configuration
with a deferred Surface. The application can use this output configuration to create a
session.

Starting from `https://developer.android.com/reference/android/os/Build.VERSION_CODES#VANILLA_ICE_CREAM`,
the deferred Surface can be obtained: (1) from `https://developer.android.com/reference/android/view/SurfaceView`
by calling `https://developer.android.com/reference/android/view/SurfaceHolder#getSurface()`, (2) from
`https://developer.android.com/reference/android/graphics/SurfaceTexture` via
`https://developer.android.com/reference/android/view/Surface#Surface(android.graphics.SurfaceTexture)`, (3) from
`https://developer.android.com/reference/android/media/MediaRecorder` via `https://developer.android.com/reference/android/media/MediaRecorder#getSurface()` or
`https://developer.android.com/reference/android/media/MediaCodec#createPersistentInputSurface()`, or (4) from
`https://developer.android.com/reference/android/media/MediaCodec` via `https://developer.android.com/reference/android/media/MediaCodec#createInputSurface()` or
`https://developer.android.com/reference/android/media/MediaCodec#createPersistentInputSurface()`.

Starting from `https://developer.android.com/reference/android/os/Build.VERSION_CODES#CINNAMON_BUN`,
the `https://developer.android.com/reference/android/media/ImageReader` deferred Surface can be obtained from
`https://developer.android.com/reference/android/media/ImageReader#getSurface()`. Do note that you should
use `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(int,%20int,%20android.util.Size,%20long)` to instantiate a
deferred ImageReader output configuration or by calling
`https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#makeDeferredAndRemoveSurfaces()` on an output configuration that has a non-deferred
ImageReader surface.

- Surfaces for `https://developer.android.com/reference/android/view/SurfaceView` and `https://developer.android.com/reference/android/graphics/SurfaceTexture` can be deferred until after `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSession(android.hardware.camera2.params.SessionConfiguration)`. In that case, the output Surface must be set via `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`, and the Surface configuration must be finalized via `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#finalizeOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)` before submitting a request with the Surface target.
- For all other target types, the output Surface must be set by `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`, and `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#finalizeOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)` is not needed because the OutputConfiguration used to create the session will contain the actual Surface.

Before `https://developer.android.com/reference/android/os/Build.VERSION_CODES#VANILLA_ICE_CREAM`, only `https://developer.android.com/reference/android/view/SurfaceView` and `https://developer.android.com/reference/android/graphics/SurfaceTexture` are supported. Both
kind of outputs can be deferred until after `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)`.

An OutputConfiguration object created by this constructor can be used for `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup#isSessionConfigurationSupported(android.hardware.camera2.params.SessionConfiguration)`
and `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup#getSessionCharacteristics(android.hardware.camera2.params.SessionConfiguration)` without
having called `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`.

<br />

<br />

| Parameters ||
|---|---|
| `surfaceSize` | `Size`: Size for the deferred surface. This value cannot be `null`. <br /> |
| `klass` | `Class`: a non-`null` `https://developer.android.com/reference/java/lang/Class` object reference that indicates the source of this surface. Only `https://developer.android.com/reference/android/view/SurfaceHolder`, `https://developer.android.com/reference/android/graphics/SurfaceTexture`, `https://developer.android.com/reference/android/media/MediaRecorder`, and `https://developer.android.com/reference/android/media/MediaCodec` are supported. Before `https://developer.android.com/reference/android/os/Build.VERSION_CODES#VANILLA_ICE_CREAM`, only `https://developer.android.com/reference/android/view/SurfaceHolder` and `https://developer.android.com/reference/android/graphics/SurfaceTexture` are supported. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the Surface source class is not supported, or Surface size is zero. |

### OutputConfiguration

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

```
public OutputConfiguration (Surface surface)
```

Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance with a `https://developer.android.com/reference/android/view/Surface`.

<br />

| Parameters ||
|---|---|
| `surface` | `Surface`: A Surface for camera to output to. This constructor creates a default configuration, with a surface group ID of `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#SURFACE_GROUP_ID_NONE`. . This value cannot be `null`. <br /> |

### OutputConfiguration

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

```
public OutputConfiguration (int format, 
                Size surfaceSize)
```

Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance for an `https://developer.android.com/reference/android/media/ImageReader` for a given
format and size.

This constructor creates an OutputConfiguration for an ImageReader without providing
the actual output Surface. The actual output Surface must be set via `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`
before creating the capture session.

An OutputConfiguration object created by this constructor can be used for `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup#isSessionConfigurationSupported(android.hardware.camera2.params.SessionConfiguration)`
and `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup#getSessionCharacteristics(android.hardware.camera2.params.SessionConfiguration)` without
having called `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`.

<br />

<br />

| Parameters ||
|---|---|
| `format` | `int`: The format of the ImageReader output. This must be one of the `https://developer.android.com/reference/android/graphics/ImageFormat` or `https://developer.android.com/reference/android/graphics/PixelFormat` constants. Note that not all formats are supported by the camera device. <br /> |
| `surfaceSize` | `Size`: Size for the ImageReader surface. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the Surface size is null or zero. |

### OutputConfiguration

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

```
public OutputConfiguration (int format, 
                Size surfaceSize, 
                long usage)
```

Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance for an `https://developer.android.com/reference/android/media/ImageReader` for a given
format, size, and usage flags.

This constructor creates an OutputConfiguration for an ImageReader without providing
the actual output Surface. The actual output Surface must be set via `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`
before creating the capture session.

An OutputConfiguration object created by this constructor can be used for `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup#isSessionConfigurationSupported(android.hardware.camera2.params.SessionConfiguration)`
and `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup#getSessionCharacteristics(android.hardware.camera2.params.SessionConfiguration)` without
having called `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`.

<br />

<br />

| Parameters ||
|---|---|
| `format` | `int`: The format of the ImageReader output. This must be one of the `https://developer.android.com/reference/android/graphics/ImageFormat` or `https://developer.android.com/reference/android/graphics/PixelFormat` constants. Note that not all formats are supported by the camera device. <br /> |
| `surfaceSize` | `Size`: Size for the ImageReader surface. This value cannot be `null`. <br /> |
| `usage` | `long`: The usage flags of the ImageReader output surface. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_CPU_READ_RARELY` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_CPU_READ_OFTEN` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_CPU_WRITE_RARELY` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_CPU_WRITE_OFTEN` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_SAMPLED_IMAGE` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_COLOR_OUTPUT` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_COMPOSER_OVERLAY` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_PROTECTED_CONTENT` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_VIDEO_ENCODE` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_DATA_BUFFER` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_SENSOR_DIRECT_DATA` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_CUBE_MAP` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_MIPMAP_COMPLETE` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_FRONT_BUFFER` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the Surface size is null or zero. |

### OutputConfiguration

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

```
public OutputConfiguration (int surfaceGroupId, 
                Surface surface)
```

Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance with a `https://developer.android.com/reference/android/view/Surface`,
with a surface group ID.


A surface group ID is used to identify which surface group this output surface belongs to. A
surface group is a group of output surfaces that are not intended to receive camera output
buffer streams simultaneously. The `https://developer.android.com/reference/android/hardware/camera2/CameraDevice` may be able to share the buffers used
by all the surfaces from the same surface group, therefore may reduce the overall memory
footprint. The application should only set the same set ID for the streams that are not
simultaneously streaming. A negative ID indicates that this surface doesn't belong to any
surface group. The default value is `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#SURFACE_GROUP_ID_NONE`.

For example, a video chat application that has an adaptive output resolution feature would
need two (or more) output resolutions, to switch resolutions without any output glitches.
However, at any given time, only one output is active to minimize outgoing network bandwidth
and encoding overhead. To save memory, the application should set the video outputs to have
the same non-negative group ID, so that the camera device can share the same memory region
for the alternating outputs.

It is not an error to include output streams with the same group ID in the same capture
request, but the resulting memory consumption may be higher than if the two streams were
not in the same surface group to begin with, especially if the outputs have substantially
different dimensions.

<br />

<br />

| Parameters ||
|---|---|
| `surfaceGroupId` | `int`: A group ID for this output, used for sharing memory between multiple outputs. <br /> |
| `surface` | `Surface`: A Surface for camera to output to. This value cannot be `null`. <br /> |

### OutputConfiguration

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

```
public OutputConfiguration (int surfaceGroupId, 
                int format, 
                Size surfaceSize)
```

Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance for an `https://developer.android.com/reference/android/media/ImageReader` for a given
surfaceGroupId, format, and size.

This constructor creates an OutputConfiguration for an ImageReader without providing
the actual output Surface. The actual output Surface must be set via `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`
before creating the capture session.

An OutputConfiguration object created by this constructor can be used for `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup#isSessionConfigurationSupported(android.hardware.camera2.params.SessionConfiguration)`
and `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup#getSessionCharacteristics(android.hardware.camera2.params.SessionConfiguration)` without
having called `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`.

<br />

<br />

| Parameters ||
|---|---|
| `surfaceGroupId` | `int`: A group ID for this output, used for sharing memory between multiple outputs. <br /> |
| `format` | `int`: The format of the ImageReader output. This must be one of the `https://developer.android.com/reference/android/graphics/ImageFormat` or `https://developer.android.com/reference/android/graphics/PixelFormat` constants. Note that not all formats are supported by the camera device. <br /> |
| `surfaceSize` | `Size`: Size for the ImageReader surface. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the Surface size is null or zero. |

### OutputConfiguration

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

```
public OutputConfiguration (int surfaceGroupId, 
                int format, 
                Size surfaceSize, 
                long usage)
```

Create a new `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instance for an `https://developer.android.com/reference/android/media/ImageReader` for a given
surface group id, format, size, and usage flags.

This constructor creates an OutputConfiguration for an ImageReader without providing
the actual output Surface. Prior to
`https://developer.android.com/reference/android/os/Build.VERSION_CODES#CINNAMON_BUN` the actual output Surface must
be set via `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)` before creating the capture session. After
`https://developer.android.com/reference/android/os/Build.VERSION_CODES#CINNAMON_BUN`, deferred ImageReader
output configurations can be used to create a capture session and then
dynamically updated by calling
`https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#updateOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)` before included in
capture requests.

An OutputConfiguration object created by this constructor can be used for `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup#isSessionConfigurationSupported(android.hardware.camera2.params.SessionConfiguration)`
and `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup#getSessionCharacteristics(android.hardware.camera2.params.SessionConfiguration)` without
having called `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`.

<br />

<br />

| Parameters ||
|---|---|
| `surfaceGroupId` | `int`: A group ID for this output, used for sharing memory between multiple outputs. <br /> |
| `format` | `int`: The format of the ImageReader output. This must be one of the `https://developer.android.com/reference/android/graphics/ImageFormat` or `https://developer.android.com/reference/android/graphics/PixelFormat` constants. Note that not all formats are supported by the camera device. <br /> |
| `surfaceSize` | `Size`: Size for the ImageReader surface. This value cannot be `null`. <br /> |
| `usage` | `long`: The usage flags of the ImageReader output surface. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_CPU_READ_RARELY` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_CPU_READ_OFTEN` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_CPU_WRITE_RARELY` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_CPU_WRITE_OFTEN` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_SAMPLED_IMAGE` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_COLOR_OUTPUT` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_COMPOSER_OVERLAY` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_PROTECTED_CONTENT` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_VIDEO_ENCODE` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_DATA_BUFFER` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_SENSOR_DIRECT_DATA` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_CUBE_MAP` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_MIPMAP_COMPLETE` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_FRONT_BUFFER` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the Surface size is null or zero. |

## Public methods

### addSensorPixelModeUsed

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

```
public void addSensorPixelModeUsed (int sensorPixelModeUsed)
```

Add a sensor pixel mode that this OutputConfiguration will be used in.

In the case that this output stream configuration (format, width, height) is
available through `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP`
configurations and
`https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP_MAXIMUM_RESOLUTION`,
configurations, the camera sub-system will assume that this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` will
be used only with `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest`s which has
`https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#SENSOR_PIXEL_MODE` set to
`https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SENSOR_PIXEL_MODE_DEFAULT`.
In such cases, if clients intend to use the
`https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`(s) in a `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest` with
other sensor pixel modes, they must specify which
`https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#SENSOR_PIXEL_MODE`(s) they will use this
`https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` with, by calling this method.

In case this output stream configuration (format, width, height) is only in
`https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP_MAXIMUM_RESOLUTION`,
configurations, this output target must only be used with
`https://developer.android.com/reference/android/hardware/camera2/CaptureRequest`s which has
`https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#SENSOR_PIXEL_MODE` set to
`https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION` and that
is what the camera sub-system will assume. If clients add
`https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SENSOR_PIXEL_MODE_DEFAULT` in this
case, session configuration will fail, if this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` is included.

In case this output stream configuration (format, width, height) is only in
`https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP`,
configurations, this output target must only be used with
`https://developer.android.com/reference/android/hardware/camera2/CaptureRequest`s which has
`https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#SENSOR_PIXEL_MODE` set to
`https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SENSOR_PIXEL_MODE_DEFAULT` and that is what
the camera sub-system will assume. If clients add
`https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION` in this
case, session configuration will fail, if this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` is included.

<br />

| Parameters ||
|---|---|
| `sensorPixelModeUsed` | `int`: The sensor pixel mode this OutputConfiguration will be used with <br /> . Value is one of the following: - `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SENSOR_PIXEL_MODE_DEFAULT` - `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION` |

### addSurface

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

```
public void addSurface (Surface surface)
```

Add a surface to this OutputConfiguration.

This function can be called before or after `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)`. If it's called after,
the application must finalize the capture session with
`https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#finalizeOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)`. It is possible to call this method
after the output configurations have been finalized only in cases of enabled surface sharing
see `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#enableSurfaceSharing()`. The modified output configuration must be updated with
`https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration)`. If this function is called before
session creation, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#finalizeOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)` doesn't need to
be called.

If the OutputConfiguration was constructed by `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(android.util.Size,%20java.lang.Class<T>)`, the added surface must be obtained:

- from `https://developer.android.com/reference/android/view/SurfaceView` by calling `https://developer.android.com/reference/android/view/SurfaceHolder#getSurface()`
- from `https://developer.android.com/reference/android/graphics/SurfaceTexture` by calling `https://developer.android.com/reference/android/view/Surface#Surface(android.graphics.SurfaceTexture)`
- from `https://developer.android.com/reference/android/media/MediaRecorder` by calling `https://developer.android.com/reference/android/media/MediaRecorder#getSurface()` or `https://developer.android.com/reference/android/media/MediaCodec#createPersistentInputSurface()`
- from `https://developer.android.com/reference/android/media/MediaCodec` by calling `https://developer.android.com/reference/android/media/MediaCodec#createInputSurface()` or `https://developer.android.com/reference/android/media/MediaCodec#createPersistentInputSurface()`

If the OutputConfiguration was constructed by `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(int,%20android.util.Size)`
or its variants, the added surface must be obtained from `https://developer.android.com/reference/android/media/ImageReader`
by calling `https://developer.android.com/reference/android/media/ImageReader#getSurface()`.

If the OutputConfiguration was constructed by other constructors, the added
surface must be compatible with the existing surface. See `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#enableSurfaceSharing()` for
details of compatible surfaces.

If the OutputConfiguration already contains a Surface, `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#enableSurfaceSharing()` must
be called before calling this function to add a new Surface.

<br />

<br />

| Parameters ||
|---|---|
| `surface` | `Surface`: The surface to be added. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the Surface is invalid, the Surface's dataspace/format doesn't match, or adding the Surface would exceed number of shared surfaces supported. |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if the Surface was already added to this OutputConfiguration, or if the OutputConfiguration is not shared and it already has a surface associated with it. |

### createInstancesForMultiResolutionOutput

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

```
public static List<OutputConfiguration> createInstancesForMultiResolutionOutput (Collection<MultiResolutionStreamInfo> streams, 
                int format)
```

Create a list of `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instances for a
`https://developer.android.com/reference/android/hardware/camera2/MultiResolutionImageReader`.

This method can be used to create query OutputConfigurations for a
MultiResolutionImageReader that can be included in a SessionConfiguration passed into
`https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup#isSessionConfigurationSupported(android.hardware.camera2.params.SessionConfiguration)`
before opening and setting up a camera device in full, at which point `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setSurfacesForMultiResolutionOutput(java.util.Collection<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.MultiResolutionImageReader)` can be used to link to the actual
MultiResolutionImageReader.

This constructor takes same arguments used to create a `https://developer.android.com/reference/android/hardware/camera2/MultiResolutionImageReader`: a collection of `https://developer.android.com/reference/android/hardware/camera2/params/MultiResolutionStreamInfo`
objects and the format.

<br />

<br />

| Parameters ||
|---|---|
| `streams` | `Collection`: The group of multi-resolution stream info objects, which are used to create a multi-resolution image reader containing a number of ImageReaders. This value cannot be `null`. <br /> |
| `format` | `int`: The format of the MultiResolutionImageReader. This must be one of the `https://developer.android.com/reference/android/graphics/ImageFormat` or `https://developer.android.com/reference/android/graphics/PixelFormat` constants supported by the camera device. Note that not all formats are supported, like `https://developer.android.com/reference/android/graphics/ImageFormat#NV21`. The supported multi-resolution reader format can be queried by `https://developer.android.com/reference/android/hardware/camera2/params/MultiResolutionStreamConfigurationMap#getOutputFormats()`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration>` | The list of `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` objects for a MultiResolutionImageReader. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the `streams` is null or doesn't contain at least 2 items, or if `format` isn't a valid camera format. |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/MultiResolutionImageReader`
- `https://developer.android.com/reference/android/hardware/camera2/params/MultiResolutionStreamInfo`

### createInstancesForMultiResolutionOutput

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

```
public static Collection<OutputConfiguration> createInstancesForMultiResolutionOutput (MultiResolutionImageReader multiResolutionImageReader)
```

Create a list of `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` instances for the outputs used by a
`https://developer.android.com/reference/android/hardware/camera2/MultiResolutionImageReader`.

This constructor takes an argument for a
`https://developer.android.com/reference/android/hardware/camera2/MultiResolutionImageReader`.

For the output configurations returned by this function, the application must
not enable surface sharing.

As of `https://developer.android.com/reference/android/os/Build.VERSION_CODES#CINNAMON_BUN`,
the application must not set different timestamp bases or different readout
timestamp enablements among the outputs. Otherwise,
`https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSession(android.hardware.camera2.params.SessionConfiguration)` will fail.

<br />

<br />

| Parameters ||
|---|---|
| `multiResolutionImageReader` | `MultiResolutionImageReader`: The multi-resolution image reader object. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration>` | This value cannot be `null`. <br /> |

### describeContents

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

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`,
the return value of this method must include the
`https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### enableSurfaceSharing

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

```
public void enableSurfaceSharing ()
```

Enable multiple surfaces sharing the same OutputConfiguration

For advanced use cases, a camera application may require more streams than the combination
guaranteed by `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSession(android.hardware.camera2.params.SessionConfiguration)`. In this case, more than one
compatible surface can be attached to an OutputConfiguration so that they map to one
camera stream, and the outputs share memory buffers when possible. Due to buffer sharing
clients should be careful when adding surface outputs that modify their input data. If such
case exists, camera clients should have an additional mechanism to synchronize read and write
access between individual consumers.

Two surfaces are compatible in the below cases:
- Surfaces with the same size, format, dataSpace, and Surface source class. In this case, `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)` is guaranteed to succeed.
- Surfaces with the same size, format, and dataSpace, but different Surface source classes that are generally not compatible. However, on some devices, the underlying camera device is able to use the same buffer layout for both surfaces. The only way to discover if this is the case is to create a capture session with that output configuration. For example, if the camera device uses the same private buffer format between a SurfaceView/SurfaceTexture and a MediaRecorder/MediaCodec, `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)` will succeed. Otherwise, it fails with `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.StateCallback#onConfigureFailed(android.hardware.camera2.CameraCaptureSession)`.

  To enable surface sharing, this function must be called before `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)` or `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createReprocessableCaptureSessionByConfigurations(android.hardware.camera2.params.InputConfiguration,%20java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)`. Calling this function after
  `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)` has no effect.

  Up to `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getMaxSharedSurfaceCount()` surfaces can be shared for an OutputConfiguration.
  The supported surfaces for sharing must be of type SurfaceTexture, SurfaceView,
  MediaRecorder, MediaCodec, or implementation defined ImageReader.

  This function must not be called from OutputConfigurations created by `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#createInstancesForMultiResolutionOutput(android.hardware.camera2.MultiResolutionImageReader)`.

  <br />

  <br />

  | Throws ||
  |---|---|
  | `https://developer.android.com/reference/java/lang/IllegalStateException` | If this OutputConfiguration is created via `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#createInstancesForMultiResolutionOutput(android.hardware.camera2.MultiResolutionImageReader)` to back a MultiResolutionImageReader. |

### equals

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

```
public boolean equals (Object obj)
```

Check if this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` is equal to another `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`.

Two output configurations are only equal if and only if the underlying surfaces, surface
properties (width, height, format, dataspace) when the output configurations are created,
and all other configuration parameters are equal.

<br />

<br />

| Parameters ||
|---|---|
| `obj` | `Object`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the objects were equal, `false` otherwise <br /> |

### getConfiguredFormat

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

```
public int getConfiguredFormat ()
```

Get the configured format associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`.

This function handles all ImageFormats and output targets supported by
the camera APIs, and isn't designed for all possible OS supported formats and
surfaces. For example, an ImageReader can be created using any combinations of
HardwareBuffer format and dataspace. If the combination is not supported
by the camera APIs, this function returns ImageFormat.UNKNOWN.

<br />

<br />

| Returns ||
|---|---|
| `int` | `https://developer.android.com/reference/android/graphics/ImageFormat` associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`. <br /> |

### getConfiguredSize

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

```
public Size getConfiguredSize ()
```

Get the latest configured size associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/util/Size` | The configured size associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`. This value cannot be `null`. <br /> |

### getDynamicRangeProfile

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

```
public long getDynamicRangeProfile ()
```

Return current dynamic range profile.

<br />

| Returns ||
|---|---|
| `long` | the currently set dynamic range profile. Value is one of the following: - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#STANDARD` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#HLG10` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#HDR10` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#HDR10_PLUS` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_REF` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_REF_PO` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_OEM` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_OEM_PO` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_REF` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_REF_PO` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_OEM` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_OEM_PO` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#STANDARD_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#HLG10_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#HDR10_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#HDR10_PLUS_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_REF_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_REF_PO_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_OEM_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_OEM_PO_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_REF_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_REF_PO_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_OEM_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_OEM_PO_SMPTE_2094_50` |

### getMaxSharedSurfaceCount

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

```
public int getMaxSharedSurfaceCount ()
```

Get the maximum supported shared `https://developer.android.com/reference/android/view/Surface` count.

<br />

| Returns ||
|---|---|
| `int` | the maximum number of surfaces that can be added per each OutputConfiguration. <br /> |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#enableSurfaceSharing()`

### getMirrorMode

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

```
public int getMirrorMode ()
```

Get the current mirroring mode

If no `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setMirrorMode(android.view.Surface,%20int)` is called first, this function returns
`https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_AUTO`.

<br />

<br />

| Returns ||
|---|---|
| `int` | The currently set mirroring mode. Value is one of the following: - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_AUTO` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_NONE` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_H` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_V` |

### getMirrorMode

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

```
public int getMirrorMode (Surface surface)
```

Get the current mirroring mode for an output surface

If no `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setMirrorMode(android.view.Surface,%20int)` is called first, this function returns
`https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_AUTO`.

If only `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setMirrorMode(int)` is called, the mirroring mode set by that
function will be returned here as long as the `surface` belongs to this
output configuration.

<br />

<br />

| Parameters ||
|---|---|
| `surface` | `Surface`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `int` | The mirroring mode for the specified output surface. Value is one of the following: - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_AUTO` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_NONE` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_H` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_V` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the `surface` doesn't belong to this OutputConfiguration. |

### getPhysicalCameraId

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

```
public String getPhysicalCameraId ()
```

Get the physical camera ID associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`.

If this OutputConfiguration isn't targeting a physical camera of a logical
multi-camera, this function returns `null`.

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The physical camera Id associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`. <br /> |

### getStreamUseCase

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

```
public long getStreamUseCase ()
```

Get the current stream use case

If no `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setStreamUseCase(long)` is called first, this function returns
`https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT`.

<br />

<br />

| Returns ||
|---|---|
| `long` | the currently set stream use case <br /> |

### getSurface

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

```
public Surface getSurface ()
```

Get the `https://developer.android.com/reference/android/view/Surface` associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`.

If more than one surface is associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`, return the
first one as specified in the constructor or `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/Surface` | This value may be `null`. <br /> |

### getSurfaceGroupId

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

```
public int getSurfaceGroupId ()
```

Get the surface group ID associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`.

<br />

| Returns ||
|---|---|
| `int` | the surface group ID associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`. The default value is `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#SURFACE_GROUP_ID_NONE`. <br /> |

### getSurfaces

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

```
public List<Surface> getSurfaces ()
```

Get the immutable list of surfaces associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/view/Surface>` | the list of surfaces associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` as specified in the constructor and `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`. The list should not be modified. This value cannot be `null`. <br /> |

### getTimestampBase

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

```
public int getTimestampBase ()
```

Get the current timestamp base

If no `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setTimestampBase(int)` is called first, this function returns
`https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_DEFAULT`.

<br />

<br />

| Returns ||
|---|---|
| `int` | The currently set timestamp base. Value is one of the following: - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_DEFAULT` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_SENSOR` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_MONOTONIC` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_REALTIME` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_CHOREOGRAPHER_SYNCED` |

### getUsage

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

```
public long getUsage ()
```

Get the usage flag associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`.

If the OutputConfiguration is created using an output surface, or using a Surface
source class, this function returns the consumer usage flag of the output surface or
the Surface source class.

If the OutputConfiguration is created using an Image format, this function returns
the application specified usage flag. If the application doesn't specify the usage flag,
the return value is 0 for `https://developer.android.com/reference/android/graphics/ImageFormat#PRIVATE` and
`https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_CPU_READ_OFTEN` for all other cases.

<br />

<br />

| Returns ||
|---|---|
| `long` | The usage flag associated with this `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration`, as defined in `https://developer.android.com/reference/android/hardware/HardwareBuffer`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_CPU_READ_RARELY` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_CPU_READ_OFTEN` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_CPU_WRITE_RARELY` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_CPU_WRITE_OFTEN` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_SAMPLED_IMAGE` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_COLOR_OUTPUT` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_COMPOSER_OVERLAY` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_PROTECTED_CONTENT` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_VIDEO_ENCODE` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_DATA_BUFFER` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_SENSOR_DIRECT_DATA` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_CUBE_MAP` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_MIPMAP_COMPLETE` - `https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_FRONT_BUFFER` |

### hashCode

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

```
public int hashCode ()
```

Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
`https://developer.android.com/reference/java/util/HashMap`.


The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### isReadoutTimestampEnabled

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

```
public boolean isReadoutTimestampEnabled ()
```

Whether readout timestamp is used for this OutputConfiguration.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setReadoutTimestampEnabled(boolean)`

### makeDeferredAndRemoveSurfaces

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

```
public OutputConfiguration makeDeferredAndRemoveSurfaces ()
```

Clear any valid output surfaces and mark the configuration as deferred.

Do note that this method is intended to be used in conjunction with
`https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#updateOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)` and not
`https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#finalizeOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)`. The latter
method is intended to be used only when clients want to finalize an
already registered deferred OutputConfiguration with a valid Surface.
However surface finalization doesn't accept deferred output
configurations. Switching a valid registered surface to deferred state
is only possible with `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration)`.

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#updateOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)`

### removeSensorPixelModeUsed

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

```
public void removeSensorPixelModeUsed (int sensorPixelModeUsed)
```

Remove a sensor pixel mode, previously added through addSensorPixelModeUsed, from this
OutputConfiguration.

Sensor pixel modes added via calls to `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSensorPixelModeUsed(int)` can also be removed
from the OutputConfiguration.

<br />

<br />

| Parameters ||
|---|---|
| `sensorPixelModeUsed` | `int`: The sensor pixel mode to be removed. Value is one of the following: - `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SENSOR_PIXEL_MODE_DEFAULT` - `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the sensor pixel mode wasn't previously added through `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSensorPixelModeUsed(int)`. |

### removeSurface

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

```
public void removeSurface (Surface surface)
```

Remove a surface from this OutputConfiguration.

Surfaces added via calls to `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)` can also be removed from the
OutputConfiguration. The only notable exception is the surface associated with
the OutputConfiguration (see `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getSurface()`) which was passed as part of the
constructor or was added first in the case of
`https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(android.util.Size,%20java.lang.Class<T>)`, `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(int,%20android.util.Size)`, `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(int,%20android.util.Size,%20long)`, `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(int,%20int,%20android.util.Size)`, `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#OutputConfiguration(int,%20int,%20android.util.Size,%20long)`.

<br />

<br />

| Parameters ||
|---|---|
| `surface` | `Surface`: The surface to be removed. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the surface is associated with this OutputConfiguration (see `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#getSurface()`) or the surface didn't get added with `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`. |

### setDynamicRangeProfile

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

```
public void setDynamicRangeProfile (long profile)
```

Set a specific device supported dynamic range profile.

Clients can choose from any profile advertised as supported in
CameraCharacteristics.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES
queried using `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#getSupportedProfiles()`.
If this is not explicitly set, then the default profile will be
`https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#STANDARD`.

Do note that invalid combinations between the registered output
surface pixel format and the configured dynamic range profile will
cause capture session initialization failure. Invalid combinations
include any 10-bit dynamic range profile advertised in
`https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#getSupportedProfiles()` combined with
an output Surface pixel format different from `https://developer.android.com/reference/android/graphics/ImageFormat#PRIVATE`
(the default for Surfaces initialized by `https://developer.android.com/reference/android/view/SurfaceView`,
`https://developer.android.com/reference/android/view/TextureView`, `https://developer.android.com/reference/android/media/MediaRecorder`,
`https://developer.android.com/reference/android/media/MediaCodec` etc.)
or `https://developer.android.com/reference/android/graphics/ImageFormat#YCBCR_P010`.

<br />

<br />

| Parameters ||
|---|---|
| `profile` | `long`: Value is one of the following: - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#STANDARD` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#HLG10` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#HDR10` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#HDR10_PLUS` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_REF` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_REF_PO` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_OEM` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_OEM_PO` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_REF` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_REF_PO` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_OEM` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_OEM_PO` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#STANDARD_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#HLG10_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#HDR10_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#HDR10_PLUS_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_REF_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_REF_PO_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_OEM_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_10B_HDR_OEM_PO_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_REF_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_REF_PO_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_OEM_SMPTE_2094_50` - `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#DOLBY_VISION_8B_HDR_OEM_PO_SMPTE_2094_50` |

### setMirrorMode

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

```
public void setMirrorMode (int mirrorMode)
```

Set the mirroring mode for this output target

If this function is not called, the mirroring mode for this output is
`https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_AUTO`, with which the camera API will mirror the output images
horizontally for front facing camera.

For efficiency, the mirror effect is applied as a transform flag, so it is only effective
in some outputs. It works automatically for SurfaceView and TextureView outputs. For manual
use of SurfaceTexture, it is reflected in the value of
`https://developer.android.com/reference/android/graphics/SurfaceTexture#getTransformMatrix(float[])`. For other end points, such as
ImageReader, MediaRecorder, or MediaCodec, the mirror mode has no effect. If mirroring is
needed for such outputs, the application needs to mirror the image buffers itself before
passing them onward.

Starting from Android 16, this function sets the mirror modes for all of the output
surfaces contained within this OutputConfiguration. To set the mirror mode for a particular
output surface, the application can call `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setMirrorMode(android.view.Surface,%20int)`. Prior to
Android 16, this function is only applicable if surface sharing is not enabled.

<br />

<br />

| Parameters ||
|---|---|
| `mirrorMode` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_AUTO` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_NONE` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_H` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_V` |

### setMirrorMode

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

```
public void setMirrorMode (Surface surface, 
                int mirrorMode)
```

Set the mirroring mode for a surface belonging to this OutputConfiguration

This function is identical to `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setMirrorMode(int)` if `surface` is
the only surface belonging to this OutputConfiguration.

If this OutputConfiguration contains a deferred surface, the application can either
call `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#setMirrorMode(int)`, or call this function after calling `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface)`.

If this OutputConfiguration contains shared surfaces, the application can set
different mirroring modes for different surfaces.

For efficiency, the mirror effect is applied as a transform flag, so it is only effective
in some outputs. It works automatically for SurfaceView and TextureView outputs. For manual
use of SurfaceTexture, it is reflected in the value of
`https://developer.android.com/reference/android/graphics/SurfaceTexture#getTransformMatrix(float[])`. For other end points, such as
ImageReader, MediaRecorder, or MediaCodec, the mirror mode has no effect. If mirroring is
needed for such outputs, the application needs to mirror the image buffers itself before
passing them onward.

<br />

<br />

| Parameters ||
|---|---|
| `surface` | `Surface`: This value cannot be `null`. <br /> |
| `mirrorMode` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_AUTO` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_NONE` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_H` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#MIRROR_MODE_V` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the `surface` doesn't belong to this OutputConfiguration, or the `mirrorMode` value is not valid. |

### setPhysicalCameraId

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

```
public void setPhysicalCameraId (String physicalCameraId)
```

Set the id of the physical camera for this OutputConfiguration

In the case one logical camera is made up of multiple physical cameras, it could be
desirable for the camera application to request streams from individual physical cameras.
This call achieves it by mapping the OutputConfiguration to the physical camera id.

The valid physical camera ids can be queried by `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#getPhysicalCameraIds()`.

Passing in a null physicalCameraId means that the OutputConfiguration is for a logical
stream.

This function must be called before `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)` or `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createReprocessableCaptureSessionByConfigurations(android.hardware.camera2.params.InputConfiguration,%20java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)`. Calling this function
after `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)` or `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createReprocessableCaptureSessionByConfigurations(android.hardware.camera2.params.InputConfiguration,%20java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)` has no effect.

As of `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S`, an image buffer from a
physical camera stream can be used for reprocessing to logical camera streams and streams
from the same physical camera if the camera device supports multi-resolution input and output
streams. See `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SCALER_MULTI_RESOLUTION_STREAM_CONFIGURATION_MAP`
for details. The behaviors of reprocessing from a non-physical camera stream to a physical
camera stream, and from a physical camera stream to a physical camera stream of different
physical camera, are device-specific and not guaranteed to be supported.

On prior API levels, the surface belonging to a physical camera OutputConfiguration must
not be used as input or output of a reprocessing request.

<br />

<br />

| Parameters ||
|---|---|
| `physicalCameraId` | `String`: This value may be `null`. <br /> |

### setReadoutTimestampEnabled

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

```
public void setReadoutTimestampEnabled (boolean on)
```

Use the camera sensor's readout time for the image timestamp.

The start of the camera sensor readout after exposure. For a rolling shutter camera
sensor, the timestamp is typically equal to `(the start of exposure time) +
(exposure time) + (certain fixed offset)`. The fixed offset can vary per session, depending
on the underlying sensor configuration. The benefit of using readout time is that when
camera runs in a fixed frame rate, the timestamp intervals between frames are constant.

Readout timestamp is supported only if `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SENSOR_READOUT_TIMESTAMP` is
`https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SENSOR_READOUT_TIMESTAMP_HARDWARE`.

As long as readout timestamp is supported, if the timestamp base is
`https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_CHOREOGRAPHER_SYNCED`, or if the timestamp base is DEFAULT for a
SurfaceView output, the image timestamps for the output are always readout time regardless
of whether this function is called.

<br />

<br />

| Parameters ||
|---|---|
| `on` | `boolean`: The output image timestamp is the start of exposure time if false, and the start of readout time if true. <br /> |

### setStreamUseCase

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

```
public void setStreamUseCase (long streamUseCase)
```

Set stream use case for this OutputConfiguration

Stream use case is used to describe the purpose of the stream, whether it's for live
preview, still image capture, video recording, or their combinations. This flag is useful
for scenarios where the immediate consumer target isn't sufficient to indicate the stream's
usage.

The main difference between stream use case and capture intent is that the former
enables the camera device to optimize camera hardware and software pipelines based on user
scenarios for each stream, whereas the latter is mainly a hint to camera to decide
optimal 3A strategy that's applicable to the whole session. The camera device carries out
configurations such as selecting tuning parameters, choosing camera sensor mode, and
constructing image processing pipeline based on the streams's use cases. Capture intents are
then used to fine tune 3A behaviors such as adjusting AE/AF convergence speed, and capture
intents may change during the lifetime of a session. For example, for a session with a
PREVIEW_VIDEO_STILL use case stream and a STILL_CAPTURE use case stream, the capture intents
may be PREVIEW with fast 3A convergence speed and flash metering with automatic control for
live preview, STILL_CAPTURE with best 3A parameters for still photo capture, or VIDEO_RECORD
with slower 3A convergence speed for better video playback experience.

The supported stream use cases supported by a camera device can be queried by
`https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SCALER_AVAILABLE_STREAM_USE_CASES`.

The mandatory stream combinations involving stream use cases can be found at `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSession(android.hardware.camera2.params.SessionConfiguration)`, as well as queried via
`https://developer.android.com/reference/android/hardware/camera2/params/MandatoryStreamCombination`. The application is
strongly recommended to select one of the guaranteed stream combinations where all streams'
use cases are set to non-DEFAULT values. If the application chooses a stream combination
not in the mandatory list, the camera device may ignore some use case flags due to
hardware constraints or implementation details.

This function must be called before `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSession(android.hardware.camera2.params.SessionConfiguration)` or `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)`. Calling this function after
`https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSession(android.hardware.camera2.params.SessionConfiguration)` or
`https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)` has no effect to the camera
session.

<br />

<br />

| Parameters ||
|---|---|
| `streamUseCase` | `long`: The stream use case to be set. Value is one of the following: - `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT` - `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW` - `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE` - `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD` - `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL` - `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL` - `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the streamUseCase isn't within the range of valid values. |

### setSurfacesForMultiResolutionOutput

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

```
public static void setSurfacesForMultiResolutionOutput (Collection<OutputConfiguration> outputConfigurations, 
                MultiResolutionImageReader multiResolutionImageReader)
```

Set the OutputConfiguration surfaces corresponding to the `https://developer.android.com/reference/android/hardware/camera2/MultiResolutionImageReader`.

This function should be used together with `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#createInstancesForMultiResolutionOutput(android.hardware.camera2.MultiResolutionImageReader)`. The application calls `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#createInstancesForMultiResolutionOutput(android.hardware.camera2.MultiResolutionImageReader)` first to create a list of
OutputConfiguration objects without the actual MultiResolutionImageReader.
Once the MultiResolutionImageReader is created later during full camera setup, the
application then calls this function to assign the surfaces to the OutputConfiguration
instances.

<br />

<br />

| Parameters ||
|---|---|
| `outputConfigurations` | `Collection`: The OutputConfiguration objects created by `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#createInstancesForMultiResolutionOutput(android.hardware.camera2.MultiResolutionImageReader)` This value cannot be `null`. <br /> |
| `multiResolutionImageReader` | `MultiResolutionImageReader`: The MultiResolutionImageReader object created from the same MultiResolutionStreamInfo parameters as `outputConfigurations`. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If `outputConfigurations` or `multiResolutionImageReader` is `null`, the `outputConfigurations` and `multiResolutionImageReader` sizes don't match, or if the `multiResolutionImageReader`'s surfaces don't match with the `outputConfigurations`. |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | If `outputConfigurations` already contains valid output surfaces. |

### setTimestampBase

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

```
public void setTimestampBase (int timestampBase)
```

Set timestamp base for this output target

Timestamp base describes the time domain of images from this
camera output and its relationship with `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE`.

If this function is not called, the timestamp base for this output
is `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_DEFAULT`, with which the camera device adjusts
timestamps based on the output target.

See `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_DEFAULT`, `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_SENSOR`,
and `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_CHOREOGRAPHER_SYNCED` for details of each timestamp base.

<br />

<br />

| Parameters ||
|---|---|
| `timestampBase` | `int`: The timestamp base to be set. Value is one of the following: - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_DEFAULT` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_SENSOR` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_MONOTONIC` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_REALTIME` - `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#TIMESTAMP_BASE_CHOREOGRAPHER_SYNCED` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the timestamp base isn't within the range of valid values. |

### writeToParcel

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

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `dest` | `Parcel`: The Parcel in which the object should be written. This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |