Camera: Fix deadlock when querying for camera muting support
Camera3Device::RequestThread can call into
Camera3Device::supportsCameraMute() while
Camera3Device::waitUntilDrained() is waiting for requestThread to
drain the camera request queue, while holding the same lock that
supportsCameraMute needs to acquire. This leads to a deadlock since
RequestThread can't make forward progress while waitUntilDrained is
waiting for it to complete.
Refactor code to pass in supportsCameraMute into RequestThread's constructor so
it can be referenced within RequestThread without querying Camera3Device.
Test: atest CtsCameraTestCases on coral
manual verification with TestingCamera2 on cuttlefish
Bug: 194765122
Change-Id: Ie9713af6961d3e085d898f351b9b1f1b6d9fdfb0
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index 733ed15..39714f0 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -813,7 +813,8 @@
sp<camera3::StatusTracker> statusTracker,
sp<HalInterface> interface,
const Vector<int32_t>& sessionParamKeys,
- bool useHalBufManager);
+ bool useHalBufManager,
+ bool supportCameraMute);
~RequestThread();
void setNotificationListener(wp<NotificationListener> listener);
@@ -1086,6 +1087,7 @@
std::map<int32_t, std::set<String8>> mGroupIdPhysicalCameraMap;
const bool mUseHalBufManager;
+ const bool mSupportCameraMute;
};
sp<RequestThread> mRequestThread;