From da4b325f41fc488df54a1cfc9ab4eaf0a5dda522 Mon Sep 17 00:00:00 2001
From: Jacopo Mondi <jacopo@jmondi.org>
Date: Fri, 29 Jan 2021 14:21:56 +0100
Subject: android: camera_device: Add missing request keys
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The Camera HAL does not report all the Request keys which are
mandatory for the advertised BACKWARD_COMPATIBLE capabilities
level. Add them.

This fixes the CTS test:
android.hardware.camera2.cts.StaticMetadataTest#testCapabilities

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/android/camera_device.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 0af05d12..ff949e30 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -705,10 +705,10 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()
 {
 	/*
 	 * \todo Keep this in sync with the actual number of entries.
-	 * Currently: 53 entries, 782 bytes of static metadata
+	 * Currently: 53 entries, 846 bytes of static metadata
 	 */
 	uint32_t numEntries = 53;
-	uint32_t byteSize = 810;
+	uint32_t byteSize = 846;
 
 	/*
 	 * Calculate space occupation in bytes for dynamically built metadata
@@ -1218,15 +1218,24 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
 		ANDROID_CONTROL_AE_MODE,
 		ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER,
 		ANDROID_CONTROL_AE_TARGET_FPS_RANGE,
+		ANDROID_CONTROL_AF_MODE,
 		ANDROID_CONTROL_AF_TRIGGER,
 		ANDROID_CONTROL_AWB_LOCK,
 		ANDROID_CONTROL_AWB_MODE,
 		ANDROID_CONTROL_CAPTURE_INTENT,
+		ANDROID_CONTROL_EFFECT_MODE,
 		ANDROID_CONTROL_MODE,
+		ANDROID_CONTROL_SCENE_MODE,
+		ANDROID_CONTROL_VIDEO_STABILIZATION_MODE,
 		ANDROID_FLASH_MODE,
+		ANDROID_JPEG_ORIENTATION,
+		ANDROID_JPEG_QUALITY,
+		ANDROID_JPEG_THUMBNAIL_QUALITY,
+		ANDROID_JPEG_THUMBNAIL_SIZE,
 		ANDROID_LENS_APERTURE,
 		ANDROID_LENS_OPTICAL_STABILIZATION_MODE,
 		ANDROID_NOISE_REDUCTION_MODE,
+		ANDROID_SCALER_CROP_REGION,
 		ANDROID_STATISTICS_FACE_DETECT_MODE
 	};
 	staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS,
-- 
cgit v1.2.1