mirror of
				https://github.com/SimpleMobileTools/Simple-Camera.git
				synced 2025-06-27 09:02:59 +02:00 
			
		
		
		
	catch all exceptions thrown at opening the camera
This commit is contained in:
		| @@ -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) { |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user