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

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

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
parent 2fd507db
Loading
Loading
Loading
Loading
+1 −19
Original line number Diff line number Diff line
@@ -157,16 +157,6 @@ status_t Camera2ClientBase<TClientBase>::initializeImpl(TProviderPtr providerPtr
        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 @@ Camera2ClientBase<TClientBase>::~Camera2ClientBase() {

    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 @@ status_t Camera2ClientBase<TClientBase>::dumpDevice(

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();
}

+0 −3
Original line number Diff line number Diff line
@@ -184,9 +184,6 @@ private:

    binder::Status disconnectImpl();

    // Watchdog thread
    sp<CameraServiceWatchdog> mCameraServiceWatchdog;

};

}; // namespace android