Loading services/camera/libcameraservice/common/CameraProviderManager.cpp +19 −39 Original line number Diff line number Diff line Loading @@ -47,8 +47,6 @@ CameraProviderManager::~CameraProviderManager() { status_t CameraProviderManager::initialize(wp<CameraProviderManager::StatusListener> listener, ServiceInteractionProxy* proxy) { int numProviders = 0; { std::lock_guard<std::mutex> lock(mInterfaceMutex); if (proxy == nullptr) { ALOGE("%s: No valid service interaction proxy provided", __FUNCTION__); Loading @@ -66,24 +64,8 @@ status_t CameraProviderManager::initialize(wp<CameraProviderManager::StatusListe "about camera providers", __FUNCTION__); return INVALID_OPERATION; } numProviders = mProviders.size(); } if (numProviders == 0) { // Remote provider might have not been initialized // Wait for a bit and see if we get one registered std::mutex mtx; std::unique_lock<std::mutex> lock(mtx); mProviderRegistered.wait_for(lock, std::chrono::seconds(15)); if (mProviders.size() == 0) { ALOGI("%s: Unable to get one registered provider within timeout!", __FUNCTION__); std::lock_guard<std::mutex> lock(mInterfaceMutex); // See if there's a passthrough HAL, but let's not complain if there's not addProvider(kLegacyProviderName, /*expected*/ false); } } return OK; } Loading Loading @@ -294,7 +276,6 @@ hardware::Return<void> CameraProviderManager::onRegistration( std::lock_guard<std::mutex> lock(mInterfaceMutex); addProvider(name); mProviderRegistered.notify_one(); return hardware::Return<void>(); } Loading Loading @@ -335,12 +316,11 @@ status_t CameraProviderManager::addProvider(const std::string& newProvider, bool mServiceProxy->getService(newProvider); if (interface == nullptr) { if (expected) { ALOGW("%s: Camera provider HAL '%s' is not actually available", __FUNCTION__, newProvider.c_str()); if (expected) { return BAD_VALUE; } else { // Not guaranteed to be found, so not an error if it wasn't return OK; } } Loading services/camera/libcameraservice/common/CameraProviderManager.h +0 −3 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ #include <vector> #include <string> #include <mutex> #include <condition_variable> #include <camera/CameraParameters2.h> #include <camera/CameraMetadata.h> Loading Loading @@ -220,8 +219,6 @@ private: // All private members, unless otherwise noted, expect mInterfaceMutex to be locked before use mutable std::mutex mInterfaceMutex; std::condition_variable mProviderRegistered; // the status listener update callbacks will lock mStatusMutex mutable std::mutex mStatusListenerMutex; wp<StatusListener> mListener; Loading Loading
services/camera/libcameraservice/common/CameraProviderManager.cpp +19 −39 Original line number Diff line number Diff line Loading @@ -47,8 +47,6 @@ CameraProviderManager::~CameraProviderManager() { status_t CameraProviderManager::initialize(wp<CameraProviderManager::StatusListener> listener, ServiceInteractionProxy* proxy) { int numProviders = 0; { std::lock_guard<std::mutex> lock(mInterfaceMutex); if (proxy == nullptr) { ALOGE("%s: No valid service interaction proxy provided", __FUNCTION__); Loading @@ -66,24 +64,8 @@ status_t CameraProviderManager::initialize(wp<CameraProviderManager::StatusListe "about camera providers", __FUNCTION__); return INVALID_OPERATION; } numProviders = mProviders.size(); } if (numProviders == 0) { // Remote provider might have not been initialized // Wait for a bit and see if we get one registered std::mutex mtx; std::unique_lock<std::mutex> lock(mtx); mProviderRegistered.wait_for(lock, std::chrono::seconds(15)); if (mProviders.size() == 0) { ALOGI("%s: Unable to get one registered provider within timeout!", __FUNCTION__); std::lock_guard<std::mutex> lock(mInterfaceMutex); // See if there's a passthrough HAL, but let's not complain if there's not addProvider(kLegacyProviderName, /*expected*/ false); } } return OK; } Loading Loading @@ -294,7 +276,6 @@ hardware::Return<void> CameraProviderManager::onRegistration( std::lock_guard<std::mutex> lock(mInterfaceMutex); addProvider(name); mProviderRegistered.notify_one(); return hardware::Return<void>(); } Loading Loading @@ -335,12 +316,11 @@ status_t CameraProviderManager::addProvider(const std::string& newProvider, bool mServiceProxy->getService(newProvider); if (interface == nullptr) { if (expected) { ALOGW("%s: Camera provider HAL '%s' is not actually available", __FUNCTION__, newProvider.c_str()); if (expected) { return BAD_VALUE; } else { // Not guaranteed to be found, so not an error if it wasn't return OK; } } Loading
services/camera/libcameraservice/common/CameraProviderManager.h +0 −3 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ #include <vector> #include <string> #include <mutex> #include <condition_variable> #include <camera/CameraParameters2.h> #include <camera/CameraMetadata.h> Loading Loading @@ -220,8 +219,6 @@ private: // All private members, unless otherwise noted, expect mInterfaceMutex to be locked before use mutable std::mutex mInterfaceMutex; std::condition_variable mProviderRegistered; // the status listener update callbacks will lock mStatusMutex mutable std::mutex mStatusListenerMutex; wp<StatusListener> mListener; Loading