Android.Hardware.Camera2.CaptureResult.ControlAfState Property
StateTransition CauseNew StateNotes
INACTIVEINACTIVENever changes
StateTransition CauseNew StateNotes
INACTIVEAF_TRIGGERACTIVE_SCANStart AF sweep, Lens now moving
ACTIVE_SCANAF sweep doneFOCUSED_LOCKEDFocused, Lens now locked
ACTIVE_SCANAF sweep doneNOT_FOCUSED_LOCKEDNot focused, Lens now locked
ACTIVE_SCANAF_CANCELINACTIVECancel/reset AF, Lens now locked
FOCUSED_LOCKEDAF_CANCELINACTIVECancel/reset AF
FOCUSED_LOCKEDAF_TRIGGERACTIVE_SCANStart new sweep, Lens now moving
NOT_FOCUSED_LOCKEDAF_CANCELINACTIVECancel/reset AF
NOT_FOCUSED_LOCKEDAF_TRIGGERACTIVE_SCANStart new sweep, Lens now moving
Any stateMode changeINACTIVE
StateTransition CauseNew StateNotes
INACTIVEAF_TRIGGERFOCUSED_LOCKEDFocus is already good or good after a scan, lens is now locked.
INACTIVEAF_TRIGGERNOT_FOCUSED_LOCKEDFocus failed after a scan, lens is now locked.
FOCUSED_LOCKEDAF_TRIGGERFOCUSED_LOCKEDFocus is already good or good after a scan, lens is now locked.
NOT_FOCUSED_LOCKEDAF_TRIGGERFOCUSED_LOCKEDFocus is good after a scan, lens is not locked.
StateTransition CauseNew StateNotes
INACTIVECamera device initiates new scanPASSIVE_SCANStart AF scan, Lens now moving
INACTIVEAF_TRIGGERNOT_FOCUSED_LOCKEDAF state query, Lens now locked
PASSIVE_SCANCamera device completes current scanPASSIVE_FOCUSEDEnd AF scan, Lens now locked
PASSIVE_SCANCamera device fails current scanPASSIVE_UNFOCUSEDEnd AF scan, Lens now locked
PASSIVE_SCANAF_TRIGGERFOCUSED_LOCKEDImmediate transition, if focus is good. Lens now locked
PASSIVE_SCANAF_TRIGGERNOT_FOCUSED_LOCKEDImmediate transition, if focus is bad. Lens now locked
PASSIVE_SCANAF_CANCELINACTIVEReset lens position, Lens now locked
PASSIVE_FOCUSEDCamera device initiates new scanPASSIVE_SCANStart AF scan, Lens now moving
PASSIVE_UNFOCUSEDCamera device initiates new scanPASSIVE_SCANStart AF scan, Lens now moving
PASSIVE_FOCUSEDAF_TRIGGERFOCUSED_LOCKEDImmediate transition, lens now locked
PASSIVE_UNFOCUSEDAF_TRIGGERNOT_FOCUSED_LOCKEDImmediate transition, lens now locked
FOCUSED_LOCKEDAF_TRIGGERFOCUSED_LOCKEDNo effect
FOCUSED_LOCKEDAF_CANCELINACTIVERestart AF scan
NOT_FOCUSED_LOCKEDAF_TRIGGERNOT_FOCUSED_LOCKEDNo effect
NOT_FOCUSED_LOCKEDAF_CANCELINACTIVERestart AF scan
StateTransition CauseNew StateNotes
INACTIVECamera device initiates new scanPASSIVE_SCANStart AF scan, Lens now moving
INACTIVEAF_TRIGGERNOT_FOCUSED_LOCKEDAF state query, Lens now locked
PASSIVE_SCANCamera device completes current scanPASSIVE_FOCUSEDEnd AF scan, Lens now locked
PASSIVE_SCANCamera device fails current scanPASSIVE_UNFOCUSEDEnd AF scan, Lens now locked
PASSIVE_SCANAF_TRIGGERFOCUSED_LOCKEDEventual transition once the focus is good. Lens now locked
PASSIVE_SCANAF_TRIGGERNOT_FOCUSED_LOCKEDEventual transition if cannot find focus. Lens now locked
PASSIVE_SCANAF_CANCELINACTIVEReset lens position, Lens now locked
PASSIVE_FOCUSEDCamera device initiates new scanPASSIVE_SCANStart AF scan, Lens now moving
PASSIVE_UNFOCUSEDCamera device initiates new scanPASSIVE_SCANStart AF scan, Lens now moving
PASSIVE_FOCUSEDAF_TRIGGERFOCUSED_LOCKEDImmediate trans. Lens now locked
PASSIVE_UNFOCUSEDAF_TRIGGERNOT_FOCUSED_LOCKEDImmediate trans. Lens now locked
FOCUSED_LOCKEDAF_TRIGGERFOCUSED_LOCKEDNo effect
FOCUSED_LOCKEDAF_CANCELINACTIVERestart AF scan
NOT_FOCUSED_LOCKEDAF_TRIGGERNOT_FOCUSED_LOCKEDNo effect
NOT_FOCUSED_LOCKEDAF_CANCELINACTIVERestart AF scan
StateTransition CauseNew StateNotes
any stateCAF-->AUTO mode switchINACTIVEMode switch without trigger, initial state must be INACTIVE
any stateCAF-->AUTO mode switch with AF_TRIGGERtrigger-reachable states from INACTIVEMode switch with trigger, INACTIVE is skipped
any stateAUTO-->CAF mode switchpassively reachable states from INACTIVEMode switch without trigger, passive transient state is skipped

Syntax

[Android.Runtime.Register("CONTROL_AF_STATE")]
public static CaptureResult.Key ControlAfState { get; }

See Also

CaptureRequest.ControlAfMode
CaptureRequest.ControlMode
CaptureRequest.ControlSceneMode

Value

Documentation for this section has not yet been entered.

Remarks

StateTransition CauseNew StateNotes
INACTIVEINACTIVENever changes
StateTransition CauseNew StateNotes
INACTIVEAF_TRIGGERACTIVE_SCANStart AF sweep, Lens now moving
ACTIVE_SCANAF sweep doneFOCUSED_LOCKEDFocused, Lens now locked
ACTIVE_SCANAF sweep doneNOT_FOCUSED_LOCKEDNot focused, Lens now locked
ACTIVE_SCANAF_CANCELINACTIVECancel/reset AF, Lens now locked
FOCUSED_LOCKEDAF_CANCELINACTIVECancel/reset AF
FOCUSED_LOCKEDAF_TRIGGERACTIVE_SCANStart new sweep, Lens now moving
NOT_FOCUSED_LOCKEDAF_CANCELINACTIVECancel/reset AF
NOT_FOCUSED_LOCKEDAF_TRIGGERACTIVE_SCANStart new sweep, Lens now moving
Any stateMode changeINACTIVE
StateTransition CauseNew StateNotes
INACTIVEAF_TRIGGERFOCUSED_LOCKEDFocus is already good or good after a scan, lens is now locked.
INACTIVEAF_TRIGGERNOT_FOCUSED_LOCKEDFocus failed after a scan, lens is now locked.
FOCUSED_LOCKEDAF_TRIGGERFOCUSED_LOCKEDFocus is already good or good after a scan, lens is now locked.
NOT_FOCUSED_LOCKEDAF_TRIGGERFOCUSED_LOCKEDFocus is good after a scan, lens is not locked.
StateTransition CauseNew StateNotes
INACTIVECamera device initiates new scanPASSIVE_SCANStart AF scan, Lens now moving
INACTIVEAF_TRIGGERNOT_FOCUSED_LOCKEDAF state query, Lens now locked
PASSIVE_SCANCamera device completes current scanPASSIVE_FOCUSEDEnd AF scan, Lens now locked
PASSIVE_SCANCamera device fails current scanPASSIVE_UNFOCUSEDEnd AF scan, Lens now locked
PASSIVE_SCANAF_TRIGGERFOCUSED_LOCKEDImmediate transition, if focus is good. Lens now locked
PASSIVE_SCANAF_TRIGGERNOT_FOCUSED_LOCKEDImmediate transition, if focus is bad. Lens now locked
PASSIVE_SCANAF_CANCELINACTIVEReset lens position, Lens now locked
PASSIVE_FOCUSEDCamera device initiates new scanPASSIVE_SCANStart AF scan, Lens now moving
PASSIVE_UNFOCUSEDCamera device initiates new scanPASSIVE_SCANStart AF scan, Lens now moving
PASSIVE_FOCUSEDAF_TRIGGERFOCUSED_LOCKEDImmediate transition, lens now locked
PASSIVE_UNFOCUSEDAF_TRIGGERNOT_FOCUSED_LOCKEDImmediate transition, lens now locked
FOCUSED_LOCKEDAF_TRIGGERFOCUSED_LOCKEDNo effect
FOCUSED_LOCKEDAF_CANCELINACTIVERestart AF scan
NOT_FOCUSED_LOCKEDAF_TRIGGERNOT_FOCUSED_LOCKEDNo effect
NOT_FOCUSED_LOCKEDAF_CANCELINACTIVERestart AF scan
StateTransition CauseNew StateNotes
INACTIVECamera device initiates new scanPASSIVE_SCANStart AF scan, Lens now moving
INACTIVEAF_TRIGGERNOT_FOCUSED_LOCKEDAF state query, Lens now locked
PASSIVE_SCANCamera device completes current scanPASSIVE_FOCUSEDEnd AF scan, Lens now locked
PASSIVE_SCANCamera device fails current scanPASSIVE_UNFOCUSEDEnd AF scan, Lens now locked
PASSIVE_SCANAF_TRIGGERFOCUSED_LOCKEDEventual transition once the focus is good. Lens now locked
PASSIVE_SCANAF_TRIGGERNOT_FOCUSED_LOCKEDEventual transition if cannot find focus. Lens now locked
PASSIVE_SCANAF_CANCELINACTIVEReset lens position, Lens now locked
PASSIVE_FOCUSEDCamera device initiates new scanPASSIVE_SCANStart AF scan, Lens now moving
PASSIVE_UNFOCUSEDCamera device initiates new scanPASSIVE_SCANStart AF scan, Lens now moving
PASSIVE_FOCUSEDAF_TRIGGERFOCUSED_LOCKEDImmediate trans. Lens now locked
PASSIVE_UNFOCUSEDAF_TRIGGERNOT_FOCUSED_LOCKEDImmediate trans. Lens now locked
FOCUSED_LOCKEDAF_TRIGGERFOCUSED_LOCKEDNo effect
FOCUSED_LOCKEDAF_CANCELINACTIVERestart AF scan
NOT_FOCUSED_LOCKEDAF_TRIGGERNOT_FOCUSED_LOCKEDNo effect
NOT_FOCUSED_LOCKEDAF_CANCELINACTIVERestart AF scan
StateTransition CauseNew StateNotes
any stateCAF-->AUTO mode switchINACTIVEMode switch without trigger, initial state must be INACTIVE
any stateCAF-->AUTO mode switch with AF_TRIGGERtrigger-reachable states from INACTIVEMode switch with trigger, INACTIVE is skipped
any stateAUTO-->CAF mode switchpassively reachable states from INACTIVEMode switch without trigger, passive transient state is skipped

Current state of auto-focus (AF) algorithm.

Switching between or enabling AF modes (CaptureRequest.ControlAfMode) always resets the AF state to INACTIVE. Similarly, switching between CaptureRequest.ControlMode, or CaptureRequest.ControlSceneMode if CaptureRequest.ControlMode == USE_SCENE_MODE resets all the algorithm states to INACTIVE.

The camera device can do several state transitions between two results, if it is allowed by the state transition table. For example: INACTIVE may never actually be seen in a result.

The state in the result is the state for this image (in sync with this image): if AF state becomes FOCUSED, then the image data associated with this result should be sharp.

Below are state transition tables for different AF modes.

When CaptureRequest.ControlAfMode is AF_MODE_OFF or AF_MODE_EDOF:

When CaptureRequest.ControlAfMode is AF_MODE_AUTO or AF_MODE_MACRO:

For the above table, the camera device may skip reporting any state changes that happen without application intervention (i.e. mode switch, trigger, locking). Any state that can be skipped in that manner is called a transient state.

For example, for these AF modes (AF_MODE_AUTO and AF_MODE_MACRO), in addition to the state transitions listed in above table, it is also legal for the camera device to skip one or more transient states between two results. See below table for examples:

When CaptureRequest.ControlAfMode is AF_MODE_CONTINUOUS_VIDEO:

When CaptureRequest.ControlAfMode is AF_MODE_CONTINUOUS_PICTURE:

When switch between AF_MODE_CONTINUOUS_* (CAF modes) and AF_MODE_AUTO/AF_MODE_MACRO (AUTO modes), the initial INACTIVE or PASSIVE_SCAN states may be skipped by the camera device. When a trigger is included in a mode switch request, the trigger will be evaluated in the context of the new mode in the request. See below table for examples:

Possible values:

This key is available on all devices.

[Android Documentation]

Requirements

Namespace: Android.Hardware.Camera2
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0