guardianproject / haven

Haven is for people who need a way to protect their personal spaces and possessions without compromising their own privacy, through an Android app and on-device sensors
https://guardianproject.github.io/haven/
GNU General Public License v3.0
6.62k stars 728 forks source link

Camera configuration crashes in Settings #376

Closed lukeswitz closed 5 years ago

lukeswitz commented 5 years ago

Workarounds: ListViewActivity > SettingsActivty - or - MonitorActivity > CameraConfigureActivity, otherwise:

02-20 11:50:56.446 20738-20825/org.havenapp.main D/Camera: app passed NULL surface
02-20 11:50:59.611 20738-20825/org.havenapp.main W/CameraBase: An error occurred while connecting to camera: 1
02-20 11:50:59.611 20738-20825/org.havenapp.main E/Camera1: createCamera: Failed to connect. Maybe in use by another app?
02-20 11:50:59.613 20738-20825/org.havenapp.main E/CameraController: uncaughtException: Interrupting thread with state: STATE_STARTING due to CameraException: com.otaliastudios.cameraview.CameraException: java.lang.RuntimeException: Fail to connect to camera service
archie94 commented 5 years ago

Calling camera.stop before entering settings is a fix.

I think it would be best to bind the Camera to a LifecycleOwner. That would reduce these boilerplate code.

archie94 commented 5 years ago

As far as I see, the current library we are using allows this.

lukeswitz commented 5 years ago

I’ll leave this to you. Cheers thanks.