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

Commit b070e1db authored by Emilian Peev's avatar Emilian Peev
Browse files

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
parent a2ac684a
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -442,11 +442,12 @@ int32_t CameraProviderManager::getTorchDefaultStrengthLevel(const std::string &i
bool CameraProviderManager::supportSetTorchMode(const std::string &id) const {
bool CameraProviderManager::supportSetTorchMode(const std::string &id) const {
    std::lock_guard<std::mutex> lock(mInterfaceMutex);
    std::lock_guard<std::mutex> lock(mInterfaceMutex);
    for (auto& provider : mProviders) {
    for (auto& provider : mProviders) {
        auto deviceInfo = findDeviceInfoLocked(id);
        for (auto& deviceInfo : provider->mDevices) {
        if (deviceInfo != nullptr) {
            if (deviceInfo->mId == id) {
                return provider->mSetTorchModeSupported;
                return provider->mSetTorchModeSupported;
            }
            }
        }
        }
    }
    return false;
    return false;
}
}