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

Commit ef782669 authored by Chien-Yu Chen's avatar Chien-Yu Chen Committed by Android Git Automerger
Browse files

am fe751bea: Camera: Fix flashlight deadlock

* commit 'fe751bea':
  Camera: Fix flashlight deadlock
parents 5dc3d992 fe751bea
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -368,7 +368,7 @@ void CameraService::onTorchStatusChangedLocked(const String8& cameraId,

    {
        // Update battery life logging for flashlight
        Mutex::Autolock al(mTorchClientMapMutex);
        Mutex::Autolock al(mTorchUidMapMutex);
        auto iter = mTorchUidMap.find(cameraId);
        if (iter != mTorchUidMap.end()) {
            int oldUid = iter->second.second;
@@ -1267,7 +1267,7 @@ status_t CameraService::setTorchMode(const String16& cameraId, bool enabled,
    {
        // Update UID map - this is used in the torch status changed callbacks, so must be done
        // before setTorchMode
        Mutex::Autolock al(mTorchClientMapMutex);
        Mutex::Autolock al(mTorchUidMapMutex);
        if (mTorchUidMap.find(id) == mTorchUidMap.end()) {
            mTorchUidMap[id].first = uid;
            mTorchUidMap[id].second = uid;
+3 −1
Original line number Diff line number Diff line
@@ -657,8 +657,10 @@ private:
    sp<CameraFlashlight> mFlashlight;
    // guard mTorchStatusMap
    Mutex                mTorchStatusMutex;
    // guard mTorchClientMap, mTorchUidMap
    // guard mTorchClientMap
    Mutex                mTorchClientMapMutex;
    // guard mTorchUidMap
    Mutex                mTorchUidMapMutex;
    // camera id -> torch status
    KeyedVector<String8, ICameraServiceListener::TorchStatus> mTorchStatusMap;
    // camera id -> torch client binder