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

The following examples show how to use android.hardware.camera2.CaptureRequest#CONTROL_AF_MODE_AUTO . 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: CameraInfo.java    From MobileInfo with Apache License 2.0 6 votes vote down vote up
private static String getAfAvailableModes(int afAvailableModes) {
    switch (afAvailableModes) {
        case CaptureRequest.CONTROL_AF_MODE_OFF:
            return "OFF";
        case CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE:
            return "CONTINUOUS_PICTURE";
        case CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_VIDEO:
            return "CONTINUOUS_VIDEO";
        case CaptureRequest.CONTROL_AF_MODE_EDOF:
            return "EDOF";
        case CaptureRequest.CONTROL_AF_MODE_MACRO:
            return "MACRO";
        case CaptureRequest.CONTROL_AF_MODE_AUTO:
            return "AUTO";

        default:
            return UNKNOWN + "-" + afAvailableModes;

    }
}
 
Example 2
Source File: Camera2Handler.java    From Augendiagnose with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final void setFocusMode(@Nullable final FocusMode focusMode) {
	if (focusMode == null) {
		mCurrentFocusMode = CaptureRequest.CONTROL_AF_MODE_OFF;
	}
	else {
		switch (focusMode) {
		case CONTINUOUS:
			mCurrentFocusMode = CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
			break;
		case AUTO:
			mCurrentFocusMode = CaptureRequest.CONTROL_AF_MODE_AUTO;
			break;
		case MACRO:
			mCurrentFocusMode = CaptureRequest.CONTROL_AF_MODE_MACRO;
			break;
		case MANUAL:
		case FIXED:
			mCurrentFocusMode = CaptureRequest.CONTROL_AF_MODE_OFF;
			break;
		default:
			mCurrentFocusMode = CaptureRequest.CONTROL_AF_MODE_AUTO;
			break;
		}
	}
	reconfigureCamera();
}
 
Example 3
Source File: AutoFocusStateMachine.java    From Camera2 with Apache License 2.0 4 votes vote down vote up
/**
 * Enable active auto focus, immediately triggering a converging scan.
 *
 * <p>This is typically only used when locking the passive AF has failed.</p>
 *
 * <p>Once active AF scanning starts, {@link AutoFocusStateListener#onAutoFocusScan} will be
 * invoked.</p>
 *
 * <p>If the active scan succeeds, {@link AutoFocusStateListener#onAutoFocusSuccess} with
 * {@code locked == true} will be invoked. If the active scan fails,
 * {@link AutoFocusStateListener#onAutoFocusFail} with {@code scanning == false} will be
 * invoked.</p>
 *
 * <p>After calling this function, submit the new requestBuilder as a separate capture.
 * Do not submit it as a repeating request or the AF trigger will be repeated every time.</p>
 *
 * <p>Create a new repeating request from repeatingBuilder and set that as the updated
 * repeating request.</p>
 *
 * @param repeatingBuilder Builder for a repeating request.
 * @param requestBuilder Builder for a non-repeating request.
 *
 * @param repeatingBuilder Builder for a repeating request.
 */
public synchronized void setActiveAutoFocus(CaptureRequest.Builder repeatingBuilder,
        CaptureRequest.Builder requestBuilder) {
    if (VERBOSE_LOGGING) Log.v(TAG, "setActiveAutoFocus");

    beginTraceAsync("AFSM_setActiveAutoFocus");

    mCurrentAfMode = CaptureRequest.CONTROL_AF_MODE_AUTO;

    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);
}