Package: android.hardware.camera.provider@2.4

ICameraProvider

interface ICameraProvider

Camera provider HAL, which enumerates the available individual camera devices known to the provider, and provides updates about changes to device status, such as connection, disconnection, or torch mode enable/disable.

The provider is responsible for generating a list of camera device service names that can then be opened via the hardware service manager.

Multiple camera provider HALs may be present in a single system.For discovery, the service names, and process names, must be of the form "android.hardware.camera.provider@< major>.<minor>/<type>/<instance>" where -<major>/<minor>is the provider HAL HIDL version, -<type>is the type of devices this provider knows about, such as "internal", "legacy", "usb", or "remote" -<instance>is a non-negative integer starting from 0 to disambiguate between multiple HALs of the same type.

The "legacy" type is only used for passthrough legacy HAL mode, and must not be used by a standalone binderized HAL.

The device instance names enumerated by the provider must be of the form "device@< major>.<minor>/<type>/<id>" where<major>/<minor>is the HIDL version of the interface .<id>is either a small incrementing integer for "internal" device types, with 0 being the main back-facing camera and 1 being the main front-facing camera, if they exist.Or, for external devices such as type "usb", a unique serial number that can be used to identify the device reliably when it is disconnected and reconnected.Multiple providers may not enumerate the same device ID.

Methods

setCallback

setCallback (ICameraProviderCallback callback)
generates (Status status)

setCallback:

Provide a callback interface to the HAL provider to inform framework of asynchronous camera events.The framework must call this function once during camera service startup, before any other calls to the provider(note that in case the camera service restarts, this method must be invoked again during its startup).

Details
Parameters
callback
A non-null callback interface to invoke when camera events occur.
Generates
status
Status code for the operation, one of:OK:On success INTERNAL_ERROR:An unexpected internal error occurred while setting the callbacks ILLEGAL_ARGUMENT:The callback argument is invalid(for example, null).

getVendorTags

getVendorTags ()
generates (Status status, vec<VendorTagSection> sections)

getVendorTags:

Retrieve all vendor tags supported by devices discoverable through this provider.The tags are grouped into sections.

Details
Generates
status
Status code for the operation, one of:OK:On success INTERNAL_ERROR:An unexpected internal error occurred while setting the callbacks
sections
The supported vendor tag sections;empty if there are no supported vendor tags, or status is not OK.

getCameraIdList

getCameraIdList ()
generates (Status status, vec<string> cameraDeviceNames)

getCameraDeviceList:

Returns the list of internal camera device interfaces known to this camera provider.These devices can then be accessed via the hardware service manager.

External camera devices(camera facing EXTERNAL)must be reported through the device status change callback, not in this list.Only devices with facing BACK or FRONT must be listed here.

Details
Generates
status
Status code for the operation, one of:OK:On a succesful generation of camera ID list INTERNAL_ERROR:A camera ID list cannot be created.This may be due to a failure to initialize the camera subsystem, for example.
cameraDeviceNames

isSetTorchModeSupported

isSetTorchModeSupported ()
generates (Status status, bool support)

isSetTorchModeSupported:

Returns if the camera devices known to this camera provider support setTorchMode API or not.If the provider does not support setTorchMode API, calling to setTorchMode will return METHOD_NOT_SUPPORTED.

Note that not every camera device has a flash unit, so even this API returns true, setTorchMode call might still fail due to the camera device does not have a flash unit.In such case, the returned status will be OPERATION_NOT_SUPPORTED.

Details
Generates
status
Status code for the operation, one of:OK:On a succesful call INTERNAL_ERROR:Torch API support cannot be queried.This may be due to a failure to initialize the camera subsystem, for example.
support
Whether the camera devices known to this provider supports setTorchMode API or not.

getCameraDeviceInterface_V1_x

getCameraDeviceInterface_V1_x (string cameraDeviceName)
generates (Status status, android.hardware.camera. device)

getCameraDeviceInterface_VN_x:

Return a android.hardware.camera.device@N.x/ICameraDevice interface for the requested device name.This does not power on the camera device, but simply acquires the interface for querying the device static information, or to additionally open the device for active use.

A separate method is required for each major revision of the camera device HAL interface, since they are not compatible with each other.

Valid device names for this provider can be obtained via either getCameraIdList(), or via availability callbacks from ICameraProviderCallback::cameraDeviceStatusChange().

The returned interface must be of the highest defined minor version for the major version;it's the responsibility of the HAL client to ensure they do not use methods/etc that are not valid for the actual minor version of the device.

Details
Parameters
cameraDeviceName
the name of the device to get an interface to.
Generates
status
Status code for the operation, one of:OK:On a succesful generation of camera ID list ILLEGAL_ARGUMENT:This device name is unknown, or has been disconnected OPERATION_NOT_SUPPORTED:The specified device does not support this major version of the HAL interface.INTERNAL_ERROR:A camera interface cannot be returned due to an unexpected internal error.
device
The inteface to this camera device, or null in case of error.