title: Flash light issue
body: <p>I am working on migrating the camera app from camera1 to camera2. I am facing a weird issue on Motorola G5 and Samsung Galaxy S4, where the flash mode is on, every time i tap on the preview view for manual focus, the flash is fired.</p>
  
  <p>Did anyone run into the same issue?
  Here is the code I use for tap to focus feature:</p>
  
  <pre><code>        val focusAreaTouch = calculateFocusArea(pointOfInterestX, pointOfInterestY, sensorArraySize)
  
          //cancel any existing AF trigger
          previewRequestBuilder?.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_CANCEL)
          previewRequestBuilder?.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_OFF)
  
          try {
              captureSession?.capture(previewRequestBuilder?.build(), captureCallback, null)
          }catch (ex: Exception) {
              Log.e(TAG, "Tap To Focus -&gt; Failed to cancel any existing AF trigger.", ex)
          }
  
          Log.e(TAG, "AF Regions: " + previewRequestBuilder?.get(CaptureRequest.CONTROL_AF_REGIONS)?.first()?.rect)
  
          //Then we add a new AF trigger with focus region
          previewRequestBuilder?.set(CaptureRequest.CONTROL_AF_REGIONS, arrayOf(focusAreaTouch))
  
          previewRequestBuilder?.set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO)
          previewRequestBuilder?.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_AUTO)
          previewRequestBuilder?.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_START)
  </code></pre>
  
  <hr>
  
  <p>Here is how I check for the AE state:</p>
  
  <pre><code>private fun process(result: CaptureResult) {
      when (state) {
          CameraState.STATE_LOCKING -&gt; {
              val af = result.get(CaptureResult.CONTROL_AF_STATE) ?: return
              if (af == CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED
                      || af == CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED
                      || af == CaptureResult.CONTROL_AF_STATE_PASSIVE_FOCUSED) {
                  val ae = result.get(CaptureResult.CONTROL_AE_STATE)
                  if (ae == null || ae == CaptureResult.CONTROL_AE_STATE_CONVERGED) {
                      state = CameraState.STATE_CAPTURING
                      onReady()
                  } else {
                      state = CameraState.STATE_LOCKED
                      onPreCaptureRequired()
                  }
              }
          }
          CameraState.STATE_PRECAPTURE -&gt; {
              val ae = result.get(CaptureResult.CONTROL_AE_STATE)
              if (ae == null || ae == CaptureResult.CONTROL_AE_STATE_PRECAPTURE ||
                      ae == CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED ||
                      ae == CaptureResult.CONTROL_AE_STATE_CONVERGED) {
                  state = CameraState.STATE_WAITING
              }
          }
          CameraState.STATE_WAITING -&gt; {
              val ae = result.get(CaptureResult.CONTROL_AE_STATE)
              if (ae == null || ae != CaptureResult.CONTROL_AE_STATE_PRECAPTURE) {
                  state = CameraState.STATE_CAPTURING
                  onReady()
              }
          }
      }
  }
  </code></pre>