The Camera2 API was introduced in Android 5.0 as a successor to the original Camera API. The API allows developers to check what camera features are available on a device and exposes granular camera features to apps, including per-frame controls for exposure and white balance gains, sharpening, denoising, etc. It’s also a prerequisite for installing Google Camera ports. With Android 13, Google is adding some new capabilities to the Camera2 API.

As spotted 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. In case a device supports other HDR formats such as HDR10+ and Dolby Vision, the device maker can advertise the recommended profile to apps using the CameraCharacteristics#REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE constant. Meanwhile, apps supporting 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 support for "stream use cases" to allow OEMs to optimize the camera performance in different streaming scenarios.

The stream use case indicates the purpose of a particular camera stream from the end-user perspective. Some examples of camera use cases are: preview stream for live viewfinder shown to the user, still capture for generating high quality photo capture, video record for encoding the camera output for the purpose of future playback, and video call for live realtime video conferencing.

If a device maker chooses to implement this capability, it's required to implement the following stream use cases:

  • PREVIEW for live viewfinder and in-app image analysis
  • STILL_CAPTURE for still photo capture
  • VIDEO_RECORD for recording video clips
  • PREVIEW_VIDEO_STILL for one single stream used for viewfinder, video recording, and still capture.
  • VIDEO_CALL for long-running video calls

When stream use cases support is available, the camera device can carry out configurations such as selecting the optimal camera sensor mode, selecting tuning parameters, and constructing 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 use cases on a device.


Source: Esper