catch all exceptions thrown at opening the camera

This commit is contained in:
tibbi 2018-06-07 11:33:18 +02:00
parent 6536bb707f
commit a037fd5761
1 changed files with 3 additions and 3 deletions

View File

@ -169,15 +169,15 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
} }
} }
@SuppressLint("MissingPermission")
private fun openCamera(width: Int, height: Int) { private fun openCamera(width: Int, height: Int) {
setupCameraOutputs(width, height)
try { try {
setupCameraOutputs(width, height)
if (!mCameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) { if (!mCameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) {
throw RuntimeException("Time out waiting to lock camera opening.") throw RuntimeException("Time out waiting to lock camera opening.")
} }
getCameraManager().openCamera(mCameraId, cameraStateCallback, mBackgroundHandler) getCameraManager().openCamera(mCameraId, cameraStateCallback, mBackgroundHandler)
} catch (e: InterruptedException) { } catch (e: Exception) {
} catch (e: SecurityException) {
} }
} }