Java Code Examples for android.hardware.camera2.CaptureRequest#CONTROL_AF_TRIGGER_START

The following examples show how to use android.hardware.camera2.CaptureRequest#CONTROL_AF_TRIGGER_START . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AutoFocusStateMachine.java    From Camera2 with Apache License 2.0 6 votes vote down vote up
/**
 * Lock the lens from moving. Typically used before taking a picture.
 *
 * <p>After calling this function, submit the new requestBuilder as a separate capture.
 * Do not submit it as a repeating request or the AF lock will be repeated every time.</p>
 *
 * <p>Create a new repeating request from repeatingBuilder and set that as the updated
 * repeating request.</p>
 *
 * <p>If the lock succeeds, {@link AutoFocusStateListener#onAutoFocusSuccess} with
 * {@code locked == true} will be invoked. If the lock fails,
 * {@link AutoFocusStateListener#onAutoFocusFail} with {@code scanning == false} will be
 * invoked.</p>
 *
 * @param repeatingBuilder Builder for a repeating request.
 * @param requestBuilder Builder for a non-repeating request.
 *
 */
public synchronized void lockAutoFocus(CaptureRequest.Builder repeatingBuilder,
        CaptureRequest.Builder requestBuilder) {

    if (VERBOSE_LOGGING) Log.v(TAG, "lockAutoFocus");

    if (mCurrentAfMode == AF_UNINITIALIZED) {
        throw new IllegalStateException("AF mode was not enabled");
    }

    beginTraceAsync("AFSM_lockAutoFocus");

    mCurrentAfTrigger = CaptureRequest.CONTROL_AF_TRIGGER_START;

    repeatingBuilder.set(CaptureRequest.CONTROL_AF_MODE, mCurrentAfMode);
    requestBuilder.set(CaptureRequest.CONTROL_AF_MODE, mCurrentAfMode);

    repeatingBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,
            CaptureRequest.CONTROL_AF_TRIGGER_IDLE);
    requestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,
            CaptureRequest.CONTROL_AF_TRIGGER_START);
}
 
Example 2
Source File: AFTriggerResult.java    From Camera2 with Apache License 2.0 5 votes vote down vote up
public AFTriggerResult()
{
    mFutureResult = SettableFuture.create();
    mStateMachine = new TriggerStateMachine(
            CaptureRequest.CONTROL_AF_TRIGGER_START,
            TRIGGER_DONE_STATES);
}