Camera: fix bufferFreed callback object lifecycle issue
Make sure the callback object won't be freed in the middle
of callback execution.
Test: CTS + stress test
Bug: 63683767
Change-Id: I6fb1b754cadb3d499c1c246687d2f60d444d00bb
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index fb46d7e..0251d62 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -337,7 +337,7 @@
std::vector<std::pair<int, uint64_t>> mFreedBuffers;
};
- std::unique_ptr<HalInterface> mInterface;
+ sp<HalInterface> mInterface;
CameraMetadata mDeviceInfo;
@@ -628,7 +628,7 @@
RequestThread(wp<Camera3Device> parent,
sp<camera3::StatusTracker> statusTracker,
- HalInterface* interface);
+ sp<HalInterface> interface);
~RequestThread();
void setNotificationListener(wp<NotificationListener> listener);
@@ -778,7 +778,7 @@
wp<Camera3Device> mParent;
wp<camera3::StatusTracker> mStatusTracker;
- HalInterface* mInterface;
+ sp<HalInterface> mInterface;
wp<NotificationListener> mListener;