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

Commit e4d3e1f4 authored by Rucha Katakwar's avatar Rucha Katakwar
Browse files

Camera: Fix up flash strength control keys

Fix up manual flash strength control keys for physical cameras.

Bug: 308758021
Test: Tested android.hardware.camera2.cts.LogicalCameraDeviceTest
Change-Id: Iee558c2379b0dc55b9bd9cfc8bf36ebcc668e00e
parent e4f0d2c5
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -1490,13 +1490,14 @@ status_t CameraProviderManager::ProviderInfo::DeviceInfo3::fixupTorchStrengthTag
    return res;
}

status_t CameraProviderManager::ProviderInfo::DeviceInfo3::fixupManualFlashStrengthControlTags() {

status_t CameraProviderManager::ProviderInfo::DeviceInfo3::fixupManualFlashStrengthControlTags(
            CameraMetadata& ch) {
    status_t res = OK;
    auto& c = mCameraCharacteristics;
    auto flashSingleStrengthMaxLevelEntry = c.find(ANDROID_FLASH_SINGLE_STRENGTH_MAX_LEVEL);
    auto flashSingleStrengthMaxLevelEntry = ch.find(ANDROID_FLASH_SINGLE_STRENGTH_MAX_LEVEL);
    if (flashSingleStrengthMaxLevelEntry.count == 0) {
        int32_t flashSingleStrengthMaxLevel = 1;
        res = c.update(ANDROID_FLASH_SINGLE_STRENGTH_MAX_LEVEL,
        res = ch.update(ANDROID_FLASH_SINGLE_STRENGTH_MAX_LEVEL,
                &flashSingleStrengthMaxLevel, 1);
        if (res != OK) {
            ALOGE("%s: Failed to update ANDROID_FLASH_SINGLE_STRENGTH_MAX_LEVEL: %s (%d)",
@@ -1504,10 +1505,11 @@ status_t CameraProviderManager::ProviderInfo::DeviceInfo3::fixupManualFlashStren
            return res;
        }
    }
    auto flashSingleStrengthDefaultLevelEntry = c.find(ANDROID_FLASH_SINGLE_STRENGTH_DEFAULT_LEVEL);
    auto flashSingleStrengthDefaultLevelEntry = ch.find(
            ANDROID_FLASH_SINGLE_STRENGTH_DEFAULT_LEVEL);
    if (flashSingleStrengthDefaultLevelEntry.count == 0) {
        int32_t flashSingleStrengthDefaultLevel = 1;
        res = c.update(ANDROID_FLASH_SINGLE_STRENGTH_DEFAULT_LEVEL,
        res = ch.update(ANDROID_FLASH_SINGLE_STRENGTH_DEFAULT_LEVEL,
                &flashSingleStrengthDefaultLevel, 1);
        if (res != OK) {
            ALOGE("%s: Failed to update ANDROID_FLASH_SINGLE_STRENGTH_DEFAULT_LEVEL: %s (%d)",
@@ -1515,10 +1517,10 @@ status_t CameraProviderManager::ProviderInfo::DeviceInfo3::fixupManualFlashStren
            return res;
        }
    }
    auto flashTorchStrengthMaxLevelEntry = c.find(ANDROID_FLASH_TORCH_STRENGTH_MAX_LEVEL);
    auto flashTorchStrengthMaxLevelEntry = ch.find(ANDROID_FLASH_TORCH_STRENGTH_MAX_LEVEL);
    if (flashTorchStrengthMaxLevelEntry.count == 0) {
        int32_t flashTorchStrengthMaxLevel = 1;
        res = c.update(ANDROID_FLASH_TORCH_STRENGTH_MAX_LEVEL,
        res = ch.update(ANDROID_FLASH_TORCH_STRENGTH_MAX_LEVEL,
                &flashTorchStrengthMaxLevel, 1);
        if (res != OK) {
            ALOGE("%s: Failed to update ANDROID_FLASH_TORCH_STRENGTH_MAX_LEVEL: %s (%d)",
@@ -1526,10 +1528,10 @@ status_t CameraProviderManager::ProviderInfo::DeviceInfo3::fixupManualFlashStren
            return res;
        }
    }
    auto flashTorchStrengthDefaultLevelEntry = c.find(ANDROID_FLASH_TORCH_STRENGTH_DEFAULT_LEVEL);
    auto flashTorchStrengthDefaultLevelEntry = ch.find(ANDROID_FLASH_TORCH_STRENGTH_DEFAULT_LEVEL);
    if (flashTorchStrengthDefaultLevelEntry.count == 0) {
        int32_t flashTorchStrengthDefaultLevel = 1;
        res = c.update(ANDROID_FLASH_TORCH_STRENGTH_DEFAULT_LEVEL,
        res = ch.update(ANDROID_FLASH_TORCH_STRENGTH_DEFAULT_LEVEL,
                &flashTorchStrengthDefaultLevel, 1);
        if (res != OK) {
            ALOGE("%s: Failed to update ANDROID_FLASH_TORCH_STRENGTH_DEFAULT_LEVEL: %s (%d)",
+1 −1
Original line number Diff line number Diff line
@@ -683,7 +683,7 @@ private:
            SystemCameraKind getSystemCameraKind();
            status_t fixupMonochromeTags();
            status_t fixupTorchStrengthTags();
            status_t fixupManualFlashStrengthControlTags();
            status_t fixupManualFlashStrengthControlTags(CameraMetadata& ch);
            status_t addDynamicDepthTags(bool maxResolution = false);
            status_t deriveHeicTags(bool maxResolution = false);
            status_t deriveJpegRTags(bool maxResolution = false);
+10 −1
Original line number Diff line number Diff line
@@ -508,7 +508,7 @@ AidlProviderInfo::AidlDeviceInfo3::AidlDeviceInfo3(
        return;
    }
    if (flags::camera_manual_flash_strength_control()) {
        res = fixupManualFlashStrengthControlTags();
        res = fixupManualFlashStrengthControlTags(mCameraCharacteristics);
        if (OK != res) {
            ALOGE("%s: Unable to fix up manual flash strength control tags: %s (%d)",
                    __FUNCTION__, strerror(-res), res);
@@ -653,6 +653,15 @@ AidlProviderInfo::AidlDeviceInfo3::AidlDeviceInfo3(
                ALOGE("%s: Unable to override zoomRatio related tags: %s (%d)",
                        __FUNCTION__, strerror(-res), res);
            }

            if (flags::camera_manual_flash_strength_control()) {
                res = fixupManualFlashStrengthControlTags(mPhysicalCameraCharacteristics[id]);
                if (OK != res) {
                    ALOGE("%s: Unable to fix up manual flash strength control tags: %s (%d)",
                            __FUNCTION__, strerror(-res), res);
                    return;
                }
            }
        }
    }

+10 −1
Original line number Diff line number Diff line
@@ -616,7 +616,7 @@ HidlProviderInfo::HidlDeviceInfo3::HidlDeviceInfo3(
        return;
    }
    if (flags::camera_manual_flash_strength_control()) {
        res = fixupManualFlashStrengthControlTags();
        res = fixupManualFlashStrengthControlTags(mCameraCharacteristics);
        if (OK != res) {
            ALOGE("%s: Unable to fix up manual flash strength control tags: %s (%d)",
                    __FUNCTION__, strerror(-res), res);
@@ -772,6 +772,15 @@ HidlProviderInfo::HidlDeviceInfo3::HidlDeviceInfo3(
                ALOGE("%s: Unable to override zoomRatio related tags: %s (%d)",
                        __FUNCTION__, strerror(-res), res);
            }

            if (flags::camera_manual_flash_strength_control()) {
                res = fixupManualFlashStrengthControlTags(mPhysicalCameraCharacteristics[id]);
                if (OK != res) {
                    ALOGE("%s: Unable to fix up manual flash strength control tags: %s (%d)",
                            __FUNCTION__, strerror(-res), res);
                    return;
                }
            }
        }
    }
}