Remove duplicate watchdog monitoring for disconnect/close
- Since the watchdog monitoring for Camera3Device::close is nested within another watchdog call for Camera2ClientBase::disconnectImpl,
there is potential for a deadlock to occur within the watchdog when one
of the nested calls aborts. While this situation is not entirely clear,
it is safer to remove the redundancy and avoid the nested call.
- We retain the monitoring of 'close' and not 'disconnectImpl’ because
'close' is a few function calls closer to the HAL and the watchdogs intention is to monitor deadlocks in the HAL without interfering with existing error
handling.
Test: Camera CTS Test
Bug: 302168348
Change-Id: I56cde7278009ef8c72b74469f29d1914f663adb8
diff --git a/services/camera/libcameraservice/common/Camera2ClientBase.cpp b/services/camera/libcameraservice/common/Camera2ClientBase.cpp
index 5c88cfa..bd39226 100644
--- a/services/camera/libcameraservice/common/Camera2ClientBase.cpp
+++ b/services/camera/libcameraservice/common/Camera2ClientBase.cpp
@@ -157,16 +157,6 @@
return res;
}
- /** Start watchdog thread */
- mCameraServiceWatchdog = new CameraServiceWatchdog(TClientBase::mCameraIdStr,
- mCameraServiceProxyWrapper);
- res = mCameraServiceWatchdog->run("Camera2ClientBaseWatchdog");
- if (res != OK) {
- ALOGE("%s: Unable to start camera service watchdog thread: %s (%d)",
- __FUNCTION__, strerror(-res), res);
- return res;
- }
-
return OK;
}
@@ -178,11 +168,6 @@
disconnect();
- if (mCameraServiceWatchdog != NULL) {
- mCameraServiceWatchdog->requestExit();
- mCameraServiceWatchdog.clear();
- }
-
ALOGI("%s: Client object's dtor for Camera Id %s completed. Client was: %s (PID %d, UID %u)",
__FUNCTION__, TClientBase::mCameraIdStr.c_str(),
TClientBase::mClientPackageName.c_str(),
@@ -268,10 +253,7 @@
template <typename TClientBase>
binder::Status Camera2ClientBase<TClientBase>::disconnect() {
- if (mCameraServiceWatchdog != nullptr && mDevice != nullptr) {
- // Initialization from hal succeeded, time disconnect.
- return mCameraServiceWatchdog->WATCH(disconnectImpl());
- }
+
return disconnectImpl();
}