title: Android L - Take flash image with autofocus using Camera2 api
body: <p>Following camera2basic guide on Android L preview page, I am able to capture normal images, i.e. without flash or using auto-focus mechanism (I rely on passive focus)</p>
  
  <p>However, I would like to take a flash image. The documentation states before taking flash image, I should call android.control.aePrecaptureTrigger to determine correct exposure.</p>
  
  <p><strong>My question:</strong></p>
  
  <ul>
  <li>How can I call AE Precapture trigger, wait for it to complete and then take the image using capture(CaptureRequest, CameraCaptureSession.CaptureListener, Handler)?</li>
  </ul>
  
  <p><strong>Method I've already tried:</strong></p>
  
  <ul>
  <li>After user clicks capture image button, I start a preview</li>
  <li>Set CONTROL_AE_PRECAPTURE_TRIGGER to CONTROL_AE_PRECAPTURE_TRIGGER_START </li>
  <li>Monitor AE_STATE result in CaptureListener's onCaptureCompleted method</li>
  <li>When AE_STATE converges, I set AE lock and take image using capture() method</li>
  </ul>
  
  <p>However, the flash image is still over-exposed and sometimes, I get complete garbage image.</p>
  
  <p>Has anyone able to get this working? </p>
  
  <p>Once this is working, auto-focus mechanism can be used in similar fashion.</p>
  
  <p>Thanks</p>