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
Fix leaked service handler bound in Preview
Luke Switzer7800be383947
diff --git a/src/main/java/org/havenapp/main/sensors/motion/Preview.java b/src/main/java/org/havenapp/main/sensors/motion/Preview.javaindex 8f08c26..cfc0605 100644--- a/src/main/java/org/havenapp/main/sensors/motion/Preview.java+++ b/src/main/java/org/havenapp/main/sensors/motion/Preview.java@@ -124,8 +124,9 @@ public class Preview extends SurfaceView implements SurfaceHolder.Callback {/** We bind to the alert service*/- context.bindService(new Intent(context,- MonitorService.class), mConnection, Context.BIND_ABOVE_CLIENT);}+ this.context.bindService(new Intent(context,+ MonitorService.class), mConnection, Context.BIND_ABOVE_CLIENT);+ }public void setMotionSensitivity (intmotionSensitivity )@@ -393,8 +394,7 @@ public class Preview extends SurfaceView implements SurfaceHolder.Callback {// Surface will be destroyed when we return, so stop the preview.// Because the CameraDevice object is not a shared resource, it's very// important to release it when the activity is paused.- if (serviceMessenger != null)- context.unbindService(mConnection);+ this.context.unbindService(mConnection);camera.setPreviewCallback(null);camera.stopPreview();diff --git a/src/main/java/org/havenapp/main/ui/CameraConfigureActivity.java b/src/main/java/org/havenapp/main/ui/CameraConfigureActivity.javaindex dd60ff4..7ceeae1 100644--- a/src/main/java/org/havenapp/main/ui/CameraConfigureActivity.java+++ b/src/main/java/org/havenapp/main/ui/CameraConfigureActivity.java@@ -126,6 +126,7 @@ public class CameraConfigureActivity extends AppCompatActivity {@Overridepublic void onResume() {super.onResume();+ mFragment.stopCamera();}@Override