Loading services/camera/libcameraservice/CameraService.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -2178,7 +2178,6 @@ Status CameraService::notifyDeviceStateChange(int64_t newState) { newDeviceState |= vendorBits; ALOGV("%s: New device state 0x%" PRIx64, __FUNCTION__, newDeviceState); Mutex::Autolock l(mServiceLock); mCameraProviderManager->notifyDeviceStateChange(newDeviceState); return Status::ok(); Loading services/camera/libcameraservice/common/CameraProviderManager.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -359,7 +359,13 @@ status_t CameraProviderManager::notifyDeviceStateChange( for (auto& provider : mProviders) { ALOGV("%s: Notifying %s for new state 0x%" PRIx64, __FUNCTION__, provider->mProviderName.c_str(), newState); // b/199240726 Camera providers can for example try to add/remove // camera devices as part of the state change notification. Holding // 'mInterfaceMutex' while calling 'notifyDeviceStateChange' can // result in a recursive deadlock. mInterfaceMutex.unlock(); status_t singleRes = provider->notifyDeviceStateChange(mDeviceState); mInterfaceMutex.lock(); if (singleRes != OK) { ALOGE("%s: Unable to notify provider %s about device state change", __FUNCTION__, Loading Loading @@ -1185,10 +1191,12 @@ status_t CameraProviderManager::getSystemCameraKindLocked(const std::string& id, } bool CameraProviderManager::isHiddenPhysicalCamera(const std::string& cameraId) const { std::lock_guard<std::mutex> lock(mInterfaceMutex); return isHiddenPhysicalCameraInternal(cameraId).first; } status_t CameraProviderManager::filterSmallJpegSizes(const std::string& cameraId) { std::lock_guard<std::mutex> lock(mInterfaceMutex); for (auto& provider : mProviders) { for (auto& deviceInfo : provider->mDevices) { if (deviceInfo->mId == cameraId) { Loading services/camera/libcameraservice/common/CameraProviderManager.h +10 −6 Original line number Diff line number Diff line Loading @@ -283,12 +283,6 @@ public: /*out*/ sp<hardware::camera::device::V3_2::ICameraDeviceSession> *session); /** * Save the ICameraProvider while it is being used by a camera or torch client */ void saveRef(DeviceMode usageType, const std::string &cameraId, sp<hardware::camera::provider::V2_4::ICameraProvider> provider); /** * Notify that the camera or torch is no longer being used by a camera client */ Loading Loading @@ -434,6 +428,10 @@ private: /** * Notify provider about top-level device physical state changes * * Note that 'mInterfaceMutex' should not be held when calling this method. * It is possible for camera providers to add/remove devices and try to * acquire it. */ status_t notifyDeviceStateChange( hardware::hidl_bitfield<hardware::camera::provider::V2_5::DeviceState> Loading Loading @@ -662,6 +660,12 @@ private: sp<hardware::camera::provider::V2_6::ICameraProvider> &interface2_6); }; /** * Save the ICameraProvider while it is being used by a camera or torch client */ void saveRef(DeviceMode usageType, const std::string &cameraId, sp<hardware::camera::provider::V2_4::ICameraProvider> provider); // Utility to find a DeviceInfo by ID; pointer is only valid while mInterfaceMutex is held // and the calling code doesn't mutate the list of providers or their lists of devices. // Finds the first device of the given ID that falls within the requested version range Loading Loading
services/camera/libcameraservice/CameraService.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -2178,7 +2178,6 @@ Status CameraService::notifyDeviceStateChange(int64_t newState) { newDeviceState |= vendorBits; ALOGV("%s: New device state 0x%" PRIx64, __FUNCTION__, newDeviceState); Mutex::Autolock l(mServiceLock); mCameraProviderManager->notifyDeviceStateChange(newDeviceState); return Status::ok(); Loading
services/camera/libcameraservice/common/CameraProviderManager.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -359,7 +359,13 @@ status_t CameraProviderManager::notifyDeviceStateChange( for (auto& provider : mProviders) { ALOGV("%s: Notifying %s for new state 0x%" PRIx64, __FUNCTION__, provider->mProviderName.c_str(), newState); // b/199240726 Camera providers can for example try to add/remove // camera devices as part of the state change notification. Holding // 'mInterfaceMutex' while calling 'notifyDeviceStateChange' can // result in a recursive deadlock. mInterfaceMutex.unlock(); status_t singleRes = provider->notifyDeviceStateChange(mDeviceState); mInterfaceMutex.lock(); if (singleRes != OK) { ALOGE("%s: Unable to notify provider %s about device state change", __FUNCTION__, Loading Loading @@ -1185,10 +1191,12 @@ status_t CameraProviderManager::getSystemCameraKindLocked(const std::string& id, } bool CameraProviderManager::isHiddenPhysicalCamera(const std::string& cameraId) const { std::lock_guard<std::mutex> lock(mInterfaceMutex); return isHiddenPhysicalCameraInternal(cameraId).first; } status_t CameraProviderManager::filterSmallJpegSizes(const std::string& cameraId) { std::lock_guard<std::mutex> lock(mInterfaceMutex); for (auto& provider : mProviders) { for (auto& deviceInfo : provider->mDevices) { if (deviceInfo->mId == cameraId) { Loading
services/camera/libcameraservice/common/CameraProviderManager.h +10 −6 Original line number Diff line number Diff line Loading @@ -283,12 +283,6 @@ public: /*out*/ sp<hardware::camera::device::V3_2::ICameraDeviceSession> *session); /** * Save the ICameraProvider while it is being used by a camera or torch client */ void saveRef(DeviceMode usageType, const std::string &cameraId, sp<hardware::camera::provider::V2_4::ICameraProvider> provider); /** * Notify that the camera or torch is no longer being used by a camera client */ Loading Loading @@ -434,6 +428,10 @@ private: /** * Notify provider about top-level device physical state changes * * Note that 'mInterfaceMutex' should not be held when calling this method. * It is possible for camera providers to add/remove devices and try to * acquire it. */ status_t notifyDeviceStateChange( hardware::hidl_bitfield<hardware::camera::provider::V2_5::DeviceState> Loading Loading @@ -662,6 +660,12 @@ private: sp<hardware::camera::provider::V2_6::ICameraProvider> &interface2_6); }; /** * Save the ICameraProvider while it is being used by a camera or torch client */ void saveRef(DeviceMode usageType, const std::string &cameraId, sp<hardware::camera::provider::V2_4::ICameraProvider> provider); // Utility to find a DeviceInfo by ID; pointer is only valid while mInterfaceMutex is held // and the calling code doesn't mutate the list of providers or their lists of devices. // Finds the first device of the given ID that falls within the requested version range Loading