catch all exceptions thrown at opening the camera
This commit is contained in:
parent
6536bb707f
commit
a037fd5761
|
@ -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) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue