Camera: Correct torch support query
The current camera provider is not used when searching
for specific devices with torch support. Any devices found
may belong to different camera provider resulting in
incorrect queries.
Bug: 233658365
Test: Camera CTS, CtsVerifier using flashlight activity
Change-Id: I09934a7799ed3f3638fefa34128e61c035b1aa84
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
index 6edf1ac..d192796 100644
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
@@ -442,9 +442,10 @@
bool CameraProviderManager::supportSetTorchMode(const std::string &id) const {
std::lock_guard<std::mutex> lock(mInterfaceMutex);
for (auto& provider : mProviders) {
- auto deviceInfo = findDeviceInfoLocked(id);
- if (deviceInfo != nullptr) {
- return provider->mSetTorchModeSupported;
+ for (auto& deviceInfo : provider->mDevices) {
+ if (deviceInfo->mId == id) {
+ return provider->mSetTorchModeSupported;
+ }
}
}
return false;