title: android.hardware.camera2 ERROR CAMERA IN USE
body: <p>I'm using the google sample 'android-Camera2Video':</p>
  
  <p><a href="https://github.com/googlesamples/android-Camera2Video" rel="noreferrer">https://github.com/googlesamples/android-Camera2Video</a></p>
  
  <p>The problem is that when the app is finishing the recording, sometimes it stucks for a moment, and then calls the <strong>onError()</strong> handler of the <strong>CameraDevice.StateCallback</strong> with 1 - '<strong>ERROR_CAMERA_IN_USE</strong>' error code.</p>
  
  <p>It does not happen every single time, it happens in about 90% of cases, and sometimes everything works fine with no errors. I couldn't find out on what it depends and how to resolve this issue. If anyone have met this problem before, please help.</p>