@@ -1090,12 +1090,50 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
staticMetadata_->addEntry(ANDROID_SENSOR_ORIENTATION, &orientation_, 1);
- std::vector<int32_t> testPatterModes = {
- ANDROID_SENSOR_TEST_PATTERN_MODE_OFF,
+ const auto &testPatternsInfo =
+ controlsInfo.find(&controls::draft::TestPatternMode);
+ std::vector<int32_t> testPatternModes = {
+ ANDROID_SENSOR_TEST_PATTERN_MODE_OFF
};
+ if (testPatternsInfo != controlsInfo.end()) {
+ const auto &values = testPatternsInfo->second.values();
+ if (!values.empty()) {
+ testPatternModes.clear();
+ for (const auto &value : values) {
+ int aValue = -1;
+ switch (value.get<int32_t>()) {
+ case controls::draft::TestPatternModeOff:
+ aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_OFF;
+ break;
+ case controls::draft::TestPatternModeSolidColor:
+ aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR;
+ break;
+ case controls::draft::TestPatternModeColorBars:
+ aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS;
+ break;
+ case controls::draft::TestPatternModeColorBarsFadeToGray:
+ aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY;
+ break;
+ case controls::draft::TestPatternModePn9:
+ aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_PN9;
+ break;
+ case controls::draft::TestPatternModeCustom1:
+ aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_CUSTOM1;
+ break;
+ default:
+ LOG(HAL, Error)
+ << "Unknown test pattern mode: "
+ << value.get<int32_t>();
+ continue;
+ }
+
+ testPatternModes.push_back(aValue);
+ }
+ }
+ }
staticMetadata_->addEntry(ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES,
- testPatterModes.data(),
- testPatterModes.size());
+ testPatternModes.data(),
+ testPatternModes.size());
uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;
staticMetadata_->addEntry(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,
Report test pattern modes obtained by Camera::controls(). Signed-off-by: Hirokazu Honda <hiroh@chromium.org> --- src/android/camera_device.cpp | 46 ++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-)