Fix external camera HAL crashes
External USB camera hal service crashes when disconnecting the camera.
ExternalCameraDeviceSession's desctructor is called and deletes mLock,
but mBufferRequestThread is still running and waiting on the same
mLock, which causes the "pthread_mutex_lock called on a destroyed
mutex" error.
Fix the issue by stopping the thread in destructor. Also refactors the
functions and remove unused conditions.
Bug: 289741662
Test: Test with USB camera
Change-Id: I06b1ff6e192a4bca16822785d65d68a6aae53414
diff --git a/camera/device/default/ExternalCameraDeviceSession.h b/camera/device/default/ExternalCameraDeviceSession.h
index e7eb799..836266f 100644
--- a/camera/device/default/ExternalCameraDeviceSession.h
+++ b/camera/device/default/ExternalCameraDeviceSession.h
@@ -240,9 +240,9 @@
// To init/close different version of output thread
void initOutputThread();
void closeOutputThread();
- void closeOutputThreadImpl();
+ void closeBufferRequestThread();
- void close(bool callerIsDtor);
+ void closeImpl();
Status initStatus() const;
status_t initDefaultRequests();