ACameraDevice_StateCallbacks

Applications' callbacks for camera device state changes, register with ACameraManager_openCamera.

Summary

Public attributes

context
void *
optional application context.
onClientSharedAccessPriorityChanged
Notify registered clients about client shared access priority changes when the camera device has been opened in shared mode.
onDisconnected
The function is called when a camera device is no longer available for use.
onError
The function called when a camera device has encountered a serious error.

Public attributes

context

Declared in camera/NdkCameraDevice.h
void * ACameraDevice_StateCallbacks::context

optional application context.

onClientSharedAccessPriorityChanged

Declared in camera/NdkCameraDevice.h
ACameraDevice_ClientSharedAccessPriorityChangedCallback ACameraDevice_StateCallbacks::onClientSharedAccessPriorityChanged

Notify registered clients about client shared access priority changes when the camera device has been opened in shared mode.

If the client priority changes from secondary to primary, then it can now create capture request and change the capture request parameters. If client priority changes from primary to secondary, that implies that another higher priority client is also accessing the camera in shared mode and is now the primary client.

onDisconnected

Declared in camera/NdkCameraDevice.h
ACameraDevice_StateCallback ACameraDevice_StateCallbacks::onDisconnected

The function is called when a camera device is no longer available for use.

Any attempt to call API methods on this ACameraDevice will return ACAMERA_ERROR_CAMERA_DISCONNECTED. The disconnection could be due to a change in security policy or permissions; the physical disconnection of a removable camera device; or the camera being needed for a higher-priority camera API client.

Application should clean up the camera with ACameraDevice_close after this happens, as it is not recoverable until the camera can be opened again.

onError

Declared in camera/NdkCameraDevice.h
ACameraDevice_ErrorStateCallback ACameraDevice_StateCallbacks::onError

The function called when a camera device has encountered a serious error.

This indicates a failure of the camera device or camera service in some way. Any attempt to call API methods on this ACameraDevice in the future will return ACAMERA_ERROR_CAMERA_DISCONNECTED.

There may still be capture completion or camera stream callbacks that will be called after this error is received.

Application should clean up the camera with ACameraDevice_close after this happens. Further attempts at recovery are error-code specific.