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

The following examples show how to use android.hardware.camera2.CaptureRequest#CONTROL_AE_STATE_FLASH_REQUIRED . 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: Camera2StateMachine.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
@Override
public void onCaptureResult(CaptureResult result, boolean isCompleted) {
    Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
    boolean isAeReady = aeState == null
            || aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED
            || aeState == CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED;
    if (isAeReady) {
        nextState(mTakePictureState);
    }
}
 
Example 2
Source File: Camera2Wrapper.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
@Override
public void onCaptureResult(CaptureResult result, boolean isCompleted) {
    Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
    if (DEBUG) {
        Log.d(TAG, "aeState: " + Camera2Helper.debugAEState(aeState) + " isCompleted: " + isCompleted);
    }
    boolean isAeReady = aeState == null
            || aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED
            || aeState == CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED;
    boolean timeout = (System.currentTimeMillis() - mStartTime) > 5000;
    if (isAeReady || timeout) {
        nextState(mTakePictureState);
    }
}
 
Example 3
Source File: LollipopCamera.java    From LiveMultimedia with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void  setupJPEGCaptureListener() {
    mCaptureCallback = new CameraCaptureSession.CaptureCallback() {
       private void process(CaptureResult result) {
                switch (mState) {
                    case STATE_PREVIEW: {
                        // We have nothing to do when the camera preview is working normally.
                        break;
                    }
                    case STATE_WAITING_LOCK: {
                            int afState = result.get(CaptureResult.CONTROL_AF_STATE);
                            if (CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED == afState ||
                                    CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED == afState) {
                                // CONTROL_AE_STATE can be null on some devices
                                Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
                                if (aeState == null ||
                                        aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED) {
                                    mState = STATE_WAITING_NON_PRECAPTURE;
                                    captureStillPicture();
                                } else {
                                    runPrecaptureSequence();
                                }
                            }
                        break;
                    }
                    case STATE_WAITING_PRECAPTURE: {
                            // CONTROL_AE_STATE can be null on some devices
                            Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
                            if (aeState == null ||
                                    aeState == CaptureResult.CONTROL_AE_STATE_PRECAPTURE ||
                                    aeState == CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED) {
                                mState = STATE_WAITING_NON_PRECAPTURE;
                            }
                        break;
                    }
                    case STATE_WAITING_NON_PRECAPTURE: {
                            // CONTROL_AE_STATE can be null on some devices
                            Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
                            if (aeState == null || aeState != CaptureResult.CONTROL_AE_STATE_PRECAPTURE) {
                                mState = STATE_PICTURE_TAKEN;
                                captureStillPicture();
                            }
                        break;
                    }
                }
            }
        };
 }