Merge "libcamera2ndk_vendor: stop looper thread on ~ACameraDevice()" into qt-r1-dev
diff --git a/camera/ndk/ndk_vendor/impl/ACameraDevice.cpp b/camera/ndk/ndk_vendor/impl/ACameraDevice.cpp
index a43d707..8a3bb46 100644
--- a/camera/ndk/ndk_vendor/impl/ACameraDevice.cpp
+++ b/camera/ndk/ndk_vendor/impl/ACameraDevice.cpp
@@ -44,6 +44,16 @@
using namespace android;
+ACameraDevice::~ACameraDevice() {
+ Mutex::Autolock _l(mDevice->mDeviceLock);
+ if (mDevice->mCbLooper != nullptr) {
+ mDevice->mCbLooper->unregisterHandler(mDevice->mHandler->id());
+ mDevice->mCbLooper->stop();
+ }
+ mDevice->mCbLooper.clear();
+ mDevice->mHandler.clear();
+}
+
namespace android {
namespace acam {
diff --git a/camera/ndk/ndk_vendor/impl/ACameraDevice.h b/camera/ndk/ndk_vendor/impl/ACameraDevice.h
index 829b084..d8df568 100644
--- a/camera/ndk/ndk_vendor/impl/ACameraDevice.h
+++ b/camera/ndk/ndk_vendor/impl/ACameraDevice.h
@@ -135,6 +135,7 @@
private:
friend ACameraCaptureSession;
+ friend ACameraDevice;
camera_status_t checkCameraClosedOrErrorLocked() const;
@@ -383,8 +384,7 @@
sp<ACameraMetadata> chars) :
mDevice(new android::acam::CameraDevice(id, cb, std::move(chars), this)) {}
- ~ACameraDevice() {};
-
+ ~ACameraDevice();
/*******************
* NDK public APIs *
*******************/