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

Commit 5dc3d992 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala Committed by Android (Google) Code Review
Browse files

Merge "Camera3Device: Don't hold mutex during HAL device close." into mnc-dr-dev

parents 3b863069 efff1c4b
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -285,19 +285,27 @@ status_t Camera3Device::disconnect() {
        mStatusTracker->join();
    }

    camera3_device_t *hal3Device;
    {
        Mutex::Autolock l(mLock);

        mRequestThread.clear();
        mStatusTracker.clear();

        if (mHal3Device != NULL) {
        hal3Device = mHal3Device;
    }

    // Call close without internal mutex held, as the HAL close may need to
    // wait on assorted callbacks,etc, to complete before it can return.
    if (hal3Device != NULL) {
        ATRACE_BEGIN("camera3->close");
            mHal3Device->common.close(&mHal3Device->common);
        hal3Device->common.close(&hal3Device->common);
        ATRACE_END();
            mHal3Device = NULL;
    }

    {
        Mutex::Autolock l(mLock);
        mHal3Device = NULL;
        internalUpdateStatusLocked(STATUS_UNINITIALIZED);
    }