Loading camera/ndk/impl/ACameraManager.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -340,6 +340,9 @@ void CameraManagerGlobal::onStatusChangedLocked( msg->setString(kCameraIdKey, AString(cameraId)); msg->post(); } if (status == hardware::ICameraServiceListener::STATUS_NOT_PRESENT) { mDeviceStatusMap.erase(cameraId); } } } // namespace android Loading services/camera/libcameraservice/CameraService.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -306,6 +306,17 @@ void CameraService::addStates(const String8 id) { logDeviceAdded(id, "Device added"); } void CameraService::removeStates(const String8 id) { if (mFlashlight->hasFlashUnit(id)) { mTorchStatusMap.removeItem(id); } { Mutex::Autolock lock(mCameraStatesLock); mCameraStates.erase(id); } } void CameraService::onDeviceStatusChanged(const String8& id, CameraDeviceStatus newHalStatus) { ALOGI("%s: Status changed for cameraId=%s, newStatus=%d", __FUNCTION__, Loading Loading @@ -370,6 +381,7 @@ void CameraService::onDeviceStatusChanged(const String8& id, clientToDisconnect->disconnect(); } removeStates(id); } else { if (oldStatus == StatusInternal::NOT_PRESENT) { logDeviceAdded(id, String8::format("Device status changed from %d to %d", oldStatus, Loading services/camera/libcameraservice/CameraService.h +2 −1 Original line number Diff line number Diff line Loading @@ -512,8 +512,9 @@ private: // Eumerate all camera providers in the system status_t enumerateProviders(); // Add a new camera to camera and torch state lists // Add a new camera to camera and torch state lists or remove an unplugged one void addStates(const String8 id); void removeStates(const String8 id); // Check if we can connect, before we acquire the service lock. // The returned originalClientPid is the PID of the original process that wants to connect to Loading services/camera/libcameraservice/common/CameraProviderManager.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -601,6 +601,15 @@ status_t CameraProviderManager::ProviderInfo::addDevice(const std::string& name, return OK; } void CameraProviderManager::ProviderInfo::removeDevice(std::string id) { for (auto it = mDevices.begin(); it != mDevices.end(); it++) { if ((*it)->mId == id) { mDevices.erase(it); break; } } } status_t CameraProviderManager::ProviderInfo::dump(int fd, const Vector<String16>&) const { dprintf(fd, "== Camera Provider HAL %s (v2.4, %s) static info: %zu devices: ==\n", mProviderName.c_str(), mInterface->isRemote() ? "remote" : "passthrough", Loading Loading @@ -674,6 +683,8 @@ hardware::Return<void> CameraProviderManager::ProviderInfo::cameraDeviceStatusCh return hardware::Void(); } addDevice(cameraDeviceName, newStatus, &id); } else if (newStatus == CameraDeviceStatus::NOT_PRESENT) { removeDevice(id); } listener = mManager->getStatusListener(); } Loading services/camera/libcameraservice/common/CameraProviderManager.h +2 −0 Original line number Diff line number Diff line Loading @@ -384,6 +384,8 @@ private: // Generate vendor tag id static metadata_vendor_id_t generateVendorTagId(const std::string &name); void removeDevice(std::string id); }; // Utility to find a DeviceInfo by ID; pointer is only valid while mInterfaceMutex is held Loading Loading
camera/ndk/impl/ACameraManager.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -340,6 +340,9 @@ void CameraManagerGlobal::onStatusChangedLocked( msg->setString(kCameraIdKey, AString(cameraId)); msg->post(); } if (status == hardware::ICameraServiceListener::STATUS_NOT_PRESENT) { mDeviceStatusMap.erase(cameraId); } } } // namespace android Loading
services/camera/libcameraservice/CameraService.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -306,6 +306,17 @@ void CameraService::addStates(const String8 id) { logDeviceAdded(id, "Device added"); } void CameraService::removeStates(const String8 id) { if (mFlashlight->hasFlashUnit(id)) { mTorchStatusMap.removeItem(id); } { Mutex::Autolock lock(mCameraStatesLock); mCameraStates.erase(id); } } void CameraService::onDeviceStatusChanged(const String8& id, CameraDeviceStatus newHalStatus) { ALOGI("%s: Status changed for cameraId=%s, newStatus=%d", __FUNCTION__, Loading Loading @@ -370,6 +381,7 @@ void CameraService::onDeviceStatusChanged(const String8& id, clientToDisconnect->disconnect(); } removeStates(id); } else { if (oldStatus == StatusInternal::NOT_PRESENT) { logDeviceAdded(id, String8::format("Device status changed from %d to %d", oldStatus, Loading
services/camera/libcameraservice/CameraService.h +2 −1 Original line number Diff line number Diff line Loading @@ -512,8 +512,9 @@ private: // Eumerate all camera providers in the system status_t enumerateProviders(); // Add a new camera to camera and torch state lists // Add a new camera to camera and torch state lists or remove an unplugged one void addStates(const String8 id); void removeStates(const String8 id); // Check if we can connect, before we acquire the service lock. // The returned originalClientPid is the PID of the original process that wants to connect to Loading
services/camera/libcameraservice/common/CameraProviderManager.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -601,6 +601,15 @@ status_t CameraProviderManager::ProviderInfo::addDevice(const std::string& name, return OK; } void CameraProviderManager::ProviderInfo::removeDevice(std::string id) { for (auto it = mDevices.begin(); it != mDevices.end(); it++) { if ((*it)->mId == id) { mDevices.erase(it); break; } } } status_t CameraProviderManager::ProviderInfo::dump(int fd, const Vector<String16>&) const { dprintf(fd, "== Camera Provider HAL %s (v2.4, %s) static info: %zu devices: ==\n", mProviderName.c_str(), mInterface->isRemote() ? "remote" : "passthrough", Loading Loading @@ -674,6 +683,8 @@ hardware::Return<void> CameraProviderManager::ProviderInfo::cameraDeviceStatusCh return hardware::Void(); } addDevice(cameraDeviceName, newStatus, &id); } else if (newStatus == CameraDeviceStatus::NOT_PRESENT) { removeDevice(id); } listener = mManager->getStatusListener(); } Loading
services/camera/libcameraservice/common/CameraProviderManager.h +2 −0 Original line number Diff line number Diff line Loading @@ -384,6 +384,8 @@ private: // Generate vendor tag id static metadata_vendor_id_t generateVendorTagId(const std::string &name); void removeDevice(std::string id); }; // Utility to find a DeviceInfo by ID; pointer is only valid while mInterfaceMutex is held Loading