private void takePicture(){
synchronized (mCameraStateLock) {
    mPendingUserCaptures++;
    if (mState != STATE_PREVIEW) {
      return;
    }
    try {
      if (!mNoAFRun) {
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,CameraMetadata.CONTROL_AF_TRIGGER_START);
      }
      if (!isLegacyLocked()) {
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER,CameraMetadata.CONTROL_AE_PRECAPTURE_TRIGGER_START);
      }
      mState=STATE_WAITING_FOR_3A_CONVERGENCE;
      startTimerLocked();
      mCaptureSession.capture(mPreviewRequestBuilder.build(),mPreCaptureCallback,mBackgroundHandler);
    }
 catch (    CameraAccessException e) {
      e.printStackTrace();
    }
  }
}

private void takePicture ( ) { synchronized ( mCameraStateLock ) { mPendingUserCaptures ++ ; if ( mState != STATE_PREVIEW ) { return ; } try { if ( ! mNoAFRun ) { mPreviewRequestBuilder . set ( CaptureRequest . CONTROL_AF_TRIGGER , CameraMetadata . CONTROL_AF_TRIGGER_START ) ; } if ( ! isLegacyLocked ( ) ) { mPreviewRequestBuilder . set ( CaptureRequest . CONTROL_AE_PRECAPTURE_TRIGGER , CameraMetadata . CONTROL_AE_PRECAPTURE_TRIGGER_START ) ; } mState = STATE_WAITING_FOR_3A_CONVERGENCE ; startTimerLocked ( ) ; mCaptureSession . capture ( mPreviewRequestBuilder . build ( ) , mPreCaptureCallback , mBackgroundHandler ) ; } catch ( CameraAccessException e ) { e . printStackTrace ( ) ; } } }
initiate a still image capture . < p / > this function sends a capture request that initiates a pre - capture sequence in our state machine that waits for auto - focus to finish , ending in a " locked " state where the lens is no longer moving , waits for auto - exposure to choose a good exposure value , and waits for auto - white - balance to converge .
