@Deprecated public abstract static class SCameraDevice.StateCallback extends Object
A callback instance must be provided to the SCameraManager.openCamera(java.lang.String, com.samsung.android.sdk.camera.SCameraDevice.StateCallback, android.os.Handler)
method to
open a camera device.
These state updates include notifications about the device completing startup (
allowing for SCameraDevice.createCaptureSession(java.util.List<android.view.Surface>, com.samsung.android.sdk.camera.SCameraCaptureSession.StateCallback, android.os.Handler)
to be called), about device
disconnection or closure, and about unexpected device errors.
Events about the progress of specific CaptureRequests
are provided
through a SCameraCaptureSession.CaptureCallback
given to the
SCameraCaptureSession.capture(com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
, SCameraCaptureSession.captureBurst(java.util.List<com.samsung.android.sdk.camera.SCaptureRequest>, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
,
SCameraCaptureSession.setRepeatingRequest(com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
, or
SCameraCaptureSession.setRepeatingBurst(java.util.List<com.samsung.android.sdk.camera.SCaptureRequest>, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
methods.
Modifier and Type | Field and Description |
---|---|
static int |
ERROR_CAMERA_DEVICE
Deprecated.
An error code that can be reported by
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
indicating that the camera device has encountered a fatal error. |
static int |
ERROR_CAMERA_DISABLED
Deprecated.
An error code that can be reported by
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
indicating that the camera device could not be opened due to a device
policy. |
static int |
ERROR_CAMERA_IN_USE
Deprecated.
An error code that can be reported by
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
indicating that the camera device is in use already. |
static int |
ERROR_CAMERA_SERVICE
Deprecated.
An error code that can be reported by
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
indicating that the camera service has encountered a fatal error. |
static int |
ERROR_MAX_CAMERAS_IN_USE
Deprecated.
An error code that can be reported by
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
indicating that the camera device could not be opened
because there are too many other open camera devices. |
Constructor and Description |
---|
StateCallback()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
onClosed(SCameraDevice camera)
Deprecated.
The method called when a camera device has been closed with
SCameraDevice.close() . |
abstract void |
onDisconnected(SCameraDevice camera)
Deprecated.
The method called when a camera device is no longer available for
use.
|
abstract void |
onError(SCameraDevice camera,
int error)
Deprecated.
The method called when a camera device has encountered a serious error.
|
abstract void |
onOpened(SCameraDevice camera)
Deprecated.
The method called when a camera device has finished opening.
|
public static final int ERROR_CAMERA_IN_USE
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
indicating that the camera device is in use already.
This error can be produced when opening the camera fails due to the camera being used by a higher-priority camera API client.
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
,
Constant Field Valuespublic static final int ERROR_MAX_CAMERAS_IN_USE
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
indicating that the camera device could not be opened
because there are too many other open camera devices.
The system-wide limit for number of open cameras has been reached, and more camera devices cannot be opened until previous instances are closed.
This error can be produced when opening the camera fails.
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
,
Constant Field Valuespublic static final int ERROR_CAMERA_DISABLED
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
indicating that the camera device could not be opened due to a device
policy.DevicePolicyManager
,
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
,
Constant Field Valuespublic static final int ERROR_CAMERA_DEVICE
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
indicating that the camera device has encountered a fatal error.
The camera device needs to be re-opened to be used again.
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
,
Constant Field Valuespublic static final int ERROR_CAMERA_SERVICE
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
indicating that the camera service has encountered a fatal error.
The Android device may need to be shut down and restarted to restore camera function, or there may be a persistent hardware problem.
An attempt at recovery may be possible by closing the SCameraDevice and the SCameraManager, and trying to acquire all resources again from scratch.
onError(com.samsung.android.sdk.camera.SCameraDevice, int)
,
Constant Field Valuespublic abstract void onOpened(SCameraDevice camera)
At this point, the camera device is ready to use, and
SCameraDevice.createCaptureSession(java.util.List<android.view.Surface>, com.samsung.android.sdk.camera.SCameraCaptureSession.StateCallback, android.os.Handler)
can be called to set up the first capture
session.
camera
- the camera device that has become openedpublic void onClosed(SCameraDevice camera)
SCameraDevice.close()
.
Any attempt to call methods on this SCameraDevice in the
future will throw a IllegalStateException
.
The default implementation of this method does nothing.
camera
- the camera device that has become closedpublic abstract void onDisconnected(SCameraDevice camera)
This callback may be called instead of onOpened(com.samsung.android.sdk.camera.SCameraDevice)
if opening the camera fails.
Any attempt to call methods on this SCameraDevice will throw a
CameraAccessException
. 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.
There may still be capture callbacks that are invoked after this method is called, or new image buffers that are delivered to active outputs.
The default implementation logs a notice to the system log about the disconnection.
You should clean up the camera with SCameraDevice.close()
after
this happens, as it is not recoverable until the camera can be opened
again. For most use cases, this will be when the camera again becomes
available
.
camera
- the device that has been disconnectedpublic abstract void onError(SCameraDevice camera, int error)
This callback may be called instead of onOpened(com.samsung.android.sdk.camera.SCameraDevice)
if opening the camera fails.
This indicates a failure of the camera device or camera service in
some way. Any attempt to call methods on this SCameraDevice in the
future will throw a CameraAccessException
with the
CAMERA_ERROR
reason.
There may still be capture completion or camera stream callbacks that will be called after this error is received.
You should clean up the camera with SCameraDevice.close()
after
this happens. Further attempts at recovery are error-code specific.
camera
- The device reporting the errorerror
- The error code, one of the
StateCallback.ERROR_*
values.ERROR_CAMERA_IN_USE
,
ERROR_MAX_CAMERAS_IN_USE
,
ERROR_CAMERA_DISABLED
,
ERROR_CAMERA_DEVICE
,
ERROR_CAMERA_SERVICE
Copyright © Samsung Electronics, Co., Ltd. All rights reserved.