From 008f2a55d141d4e5257ed83e7714d88734d67dde Mon Sep 17 00:00:00 2001
From: Jacopo Mondi <jacopo@jmondi.org>
Date: Wed, 9 Dec 2020 18:35:42 +0100
Subject: android: camera_device: Temporary fix sensor properties

The ChromeOS camera service, which is the current main user of the
Android Camera HAL, fails to start if the pixel array properties are
not registered.

As the sensor driver for the Soraka test device have not yet been
updated to report their pixel array properties through the V4L2
selection API, temporary fix the gap by re-establishing the default
properties values removed by commit 1889cdc2e91c ("android: camera_device:
Initialize pixel array properties")

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/android/camera_device.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

(limited to 'src/android')

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 38689bdc..89f10e74 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -860,6 +860,14 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
 		};
 		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
 					  data.data(), data.size());
+	} else {
+		/*
+		 * \todo Drop the default once the ov5670 and ov13858 drivers
+		 * are updated to report the pixel array size.
+		 */
+		int32_t data[] = { 2592, 1944 };
+		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
+					  data, 2);
 	}
 
 	if (properties.contains(properties::PixelArrayActiveAreas)) {
@@ -873,6 +881,14 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
 		};
 		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
 					  data.data(), data.size());
+	} else {
+		/*
+		 * \todo Drop the default once the ov5670 and ov13858 drivers
+		 * are updated to report the pixel array size.
+		 */
+		int32_t data[] = { 0, 0, 2560, 1920 };
+		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
+					  data, 4);
 	}
 
 	int32_t sensitivityRange[] = {
-- 
cgit v1.2.1