Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1698225 authored by Ravneet Dhanjal's avatar Ravneet Dhanjal
Browse files

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
parent 2cda3acf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 {
+1 −8
Original line number Diff line number Diff line
@@ -269,15 +269,8 @@ status_t Camera2ClientBase<TClientBase>::dumpDevice(
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();
}
+0 −3
Original line number Diff line number Diff line
@@ -137,9 +137,6 @@ public:

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;