CameraService: Increase watchdog timer
- Address the frequent firing of the watchdog for disconnect() which has
often become an obstacle for debugging
- Increase default timer to a larger value of 65 seconds to prevent
thwarting of ANR error handling, since Watchdog.java triggers ANR handling after 60 seconds
- Even with the extension to a substantial duration of 65 sec, the
watchdog will retain its original intent to identify issues like
deadlocks and terminate to prevent resource consumption while preserving
existing error handling
Test: Camera CTS test; Manual trigger of watchdog
Bug: 297373268
Bug: 282904703
Change-Id: I90739ce790ad25000ad7e67523f728c24dc7d2d5
diff --git a/services/camera/libcameraservice/CameraServiceWatchdog.h b/services/camera/libcameraservice/CameraServiceWatchdog.h
index 9f25865..afc432d 100644
--- a/services/camera/libcameraservice/CameraServiceWatchdog.h
+++ b/services/camera/libcameraservice/CameraServiceWatchdog.h
@@ -44,7 +44,7 @@
watchThread([&]() { return toMonitor;}, gettid(), __FUNCTION__, cycles, cycleLength);
// Default cycles and cycle length values used to calculate permitted elapsed time
-const static size_t kMaxCycles = 100;
+const static size_t kMaxCycles = 650;
const static uint32_t kCycleLengthMs = 100;
namespace android {
diff --git a/services/camera/libcameraservice/common/Camera2ClientBase.cpp b/services/camera/libcameraservice/common/Camera2ClientBase.cpp
index a54ba9b..a611cc6 100644
--- a/services/camera/libcameraservice/common/Camera2ClientBase.cpp
+++ b/services/camera/libcameraservice/common/Camera2ClientBase.cpp
@@ -269,15 +269,8 @@
template <typename TClientBase>
binder::Status Camera2ClientBase<TClientBase>::disconnect() {
if (mCameraServiceWatchdog != nullptr && mDevice != nullptr) {
- // Timer for the disconnect call should be greater than getExpectedInFlightDuration
- // since this duration is used to error handle methods in the disconnect sequence
- // thus allowing existing error handling methods to execute first
- uint64_t maxExpectedDuration =
- ns2ms(mDevice->getExpectedInFlightDuration() + kBufferTimeDisconnectNs);
-
// Initialization from hal succeeded, time disconnect.
- return mCameraServiceWatchdog->WATCH_CUSTOM_TIMER(disconnectImpl(),
- maxExpectedDuration / kCycleLengthMs, kCycleLengthMs);
+ return mCameraServiceWatchdog->WATCH(disconnectImpl());
}
return disconnectImpl();
}
diff --git a/services/camera/libcameraservice/common/Camera2ClientBase.h b/services/camera/libcameraservice/common/Camera2ClientBase.h
index 30c763d..88d65dc 100644
--- a/services/camera/libcameraservice/common/Camera2ClientBase.h
+++ b/services/camera/libcameraservice/common/Camera2ClientBase.h
@@ -137,9 +137,6 @@
protected:
- // Used for watchdog timeout to monitor disconnect
- static const nsecs_t kBufferTimeDisconnectNs = 3000000000; // 3 sec.
-
// The PID provided in the constructor call
pid_t mInitialClientPid;
bool mOverrideForPerfClass = false;