The Camera2 API was introduced in Android 5.0 as a successor to the original Camera API. The API allows developers to control what camera features are available on a device and exposes granular camera features for apps, including controls per. frame for exposure and white balance enhancements, sharpness, attenuation, etc. It is also a prerequisite for installing Google Camera ports. With Android 13, Google is adding some new features to the Camera2 API.
As seen by Esper, Android 13’s HAL allows smartphone makers to expose 10-bit video output to the Camera2 API. If an OEM chooses to expose 10-bit camera output, it must at least support the HLG10 profile. If a device supports other HDR formats such as HDR10 + and Dolby Vision, the device manufacturer can announce the recommended profile for apps using the CameraCharacteristics #REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE constant. Meanwhile, apps that support the Camera2 API can set a specific device-supported dynamic range profile using the OutputConfiguration.setDynamicRangeProfile API.
In addition to the HDR video support, the Camera2 API also adds “stream use cases” support to enable OEMs to optimize the camera’s performance in various streaming scenarios.
The Stream use case indicates the purpose of a particular camera stream from the end user’s perspective. Some examples of camera usage are: live view preview stream for the user, still recording to generate high quality photo recording, video recording to encode camera output for future playback, and video calls to live video conferencing in real time.
If a device manufacturer chooses to implement this feature, it is required to implement the following instances of stream usage:
- PREVIEW for live viewfinder and image analysis in the app
- STILL_CAPTURE for still images
- VIDEO_RECORD for recording video clips
- PREVIEW_VIDEO_STILL for a single stream used for viewfinder, video recording and still images.
- VIDEO_CALL for long video calls
When stream use cases support is available, the camera device can perform configurations such as selecting the optimal camera sensor mode, selecting setting parameters, and constructing the image processing pipeline using the Camera2 API. Apps can use the CameraCharacteristics # SCALER_AVAILABLE_STREAM_USE_CASES field to query the list of supported Steam usage cases on a device.