faceunlock: Make background thread methods synchronous
- causing many issues due to race conditions
Change-Id: Id7512f1c3c6367a5caa0e17d5f4295ed7381d865
diff --git a/framework/server/com/libremobileos/faceunlock/server/CameraService.java b/framework/server/com/libremobileos/faceunlock/server/CameraService.java
index 9237544..1690907 100644
--- a/framework/server/com/libremobileos/faceunlock/server/CameraService.java
+++ b/framework/server/com/libremobileos/faceunlock/server/CameraService.java
@@ -113,13 +113,13 @@
}
};
- public void startBackgroundThread() {
+ public synchronized void startBackgroundThread() {
mBackgroundThread = new HandlerThread("Camera Background");
mBackgroundThread.start();
mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
}
- public void stopBackgroundThread() {
+ public synchronized void stopBackgroundThread() {
closeCamera();
mBackgroundThread.quitSafely();
try {
@@ -382,4 +382,4 @@
}
Trace.endSection();
}
-}
\ No newline at end of file
+}