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
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
index 937d755..3801470 100644
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
@@ -1490,13 +1490,14 @@
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 @@
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 @@
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 @@
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)",
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.h b/services/camera/libcameraservice/common/CameraProviderManager.h
index 37a9ccb..2a5e73b 100644
--- a/services/camera/libcameraservice/common/CameraProviderManager.h
+++ b/services/camera/libcameraservice/common/CameraProviderManager.h
@@ -683,7 +683,7 @@
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);
diff --git a/services/camera/libcameraservice/common/aidl/AidlProviderInfo.cpp b/services/camera/libcameraservice/common/aidl/AidlProviderInfo.cpp
index f5279aa..9f28b5f 100644
--- a/services/camera/libcameraservice/common/aidl/AidlProviderInfo.cpp
+++ b/services/camera/libcameraservice/common/aidl/AidlProviderInfo.cpp
@@ -508,7 +508,7 @@
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 @@
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;
+ }
+ }
}
}
diff --git a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
index 4197358..e4bd503 100644
--- a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
+++ b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
@@ -616,7 +616,7 @@
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 @@
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;
+ }
+ }
}
}
}