CameraInfo
public
interface
CameraInfo
| androidx.camera.core.CameraInfo |
An interface for retrieving camera information.
Applications can retrieve an instance via Camera.getCameraInfo().
Summary
Public methods | |
|---|---|
abstract
CameraSelector
|
getCameraSelector()
Returns a |
abstract
LiveData<CameraState>
|
getCameraState()
Returns a |
abstract
ExposureState
|
getExposureState()
Returns a |
abstract
int
|
getSensorRotationDegrees()
Returns the sensor rotation in degrees, relative to the device's "natural" (default) orientation. |
abstract
int
|
getSensorRotationDegrees(int relativeRotation)
Returns the sensor rotation, in degrees, relative to the given rotation value. |
abstract
LiveData<Integer>
|
getTorchState()
Returns a |
abstract
LiveData<ZoomState>
|
getZoomState()
|
abstract
boolean
|
hasFlashUnit()
Returns if flash unit is available or not. |
default
boolean
|
isFocusMeteringSupported(FocusMeteringAction action)
Returns if the given |
Public methods
getCameraSelector
public abstract CameraSelector getCameraSelector ()
Returns a CameraSelector unique to this camera.
| Returns | |
|---|---|
CameraSelector |
CameraSelector unique to this camera.
|
getCameraState
public abstract LiveData<CameraState> getCameraState ()
Returns a LiveData of the camera's state.
The LiveData will be updated whenever the camera's
state changes, and can be any of the following: CameraState.Type.PENDING_OPEN,
CameraState.Type.OPENING, CameraState.Type.OPEN,
CameraState.Type.CLOSING and CameraState.Type.CLOSED.
Due to the inner workings of LiveData, some reported camera states may be
ignored if a newer value is posted before the observers are updated. For instance, this can
occur when the camera is opening or closing, the CameraState.Type.OPENING and
CameraState.Type.CLOSING states may not be reported to observers if they are rapidly
followed by the CameraState.Type.OPEN and CameraState.Type.CLOSED states
respectively.
| Returns | |
|---|---|
LiveData<CameraState> |
A LiveData of the camera's state.
|
getExposureState
public abstract ExposureState getExposureState ()
Returns a ExposureState.
The ExposureState contains the current exposure related information.
| Returns | |
|---|---|
ExposureState |
|
getSensorRotationDegrees
public abstract int getSensorRotationDegrees ()
Returns the sensor rotation in degrees, relative to the device's "natural" (default) orientation.
| Returns | |
|---|---|
int |
The sensor rotation in degrees, relative to device's "natural" (default) orientation. |
See also:
getSensorRotationDegrees
public abstract int getSensorRotationDegrees (int relativeRotation)
Returns the sensor rotation, in degrees, relative to the given rotation value.
Valid values for the relative rotation are Surface.ROTATION_0 (natural), Surface.ROTATION_90, Surface.ROTATION_180, Surface.ROTATION_270.
| Parameters | |
|---|---|
relativeRotation |
int: The rotation relative to which the output will be calculated. |
| Returns | |
|---|---|
int |
The sensor rotation in degrees. |
getTorchState
public abstract LiveData<Integer> getTorchState ()
Returns a LiveData of current TorchState.
The torch can be turned on and off via CameraControl.enableTorch(boolean) which
will trigger the change event to the returned LiveData. Apps can either get
immediate value via LiveData.getValue() or observe it via
LiveData.observe(LifecycleOwner, Observer) to update torch UI accordingly.
If the camera doesn't have a flash unit (see hasFlashUnit()), then the torch
state will be TorchState.OFF.
| Returns | |
|---|---|
LiveData<Integer> |
a LiveData containing current torch state.
|
getZoomState
public abstract LiveData<ZoomState> getZoomState ()
Returns a LiveData of ZoomState.
The LiveData will be updated whenever the set zoom state has been changed. This can
occur when the application updates the zoom via CameraControl.setZoomRatio(float)
or CameraControl.setLinearZoom(float). The zoom state can also change anytime a
camera starts up, for example when a UseCase is bound to it.
| Returns | |
|---|---|
LiveData<ZoomState> |
|
hasFlashUnit
public abstract boolean hasFlashUnit ()
Returns if flash unit is available or not.
| Returns | |
|---|---|
boolean |
|
isFocusMeteringSupported
public boolean isFocusMeteringSupported (FocusMeteringAction action)
Returns if the given FocusMeteringAction is supported on the devices.
It returns true if at least one valid AF/AE/AWB region generated by the given
FocusMeteringAction is supported on the current camera. For example, on a camera
supporting only AF regions, passing in a FocusMeteringAction specifying AF/AE regions
to this API will still return true. But it will return false if the
FocusMeteringAction specifies only the AE region since none of the specified
regions are supported.
If it returns false, invoking
CameraControl.startFocusAndMetering(FocusMeteringAction) with the given
FocusMeteringAction will always fail.
| Parameters | |
|---|---|
action |
FocusMeteringAction |
| Returns | |
|---|---|
boolean |
|