camera: Make readoutTimestamp visible to HALs
`readoutTimestamp` metadata key was previously only visible to
SDK and the framework, and the camera framework force set the values
based on if the HAL implemented the AIDL or the HIDL interface.
This CL makes readoutTimestamp available to HALs and lets AIDL
HALs choose if they can support sensor readout timestamp or not.
Bug: 309543399
Test: External Camera HAL now sets this value and passes VTS
Change-Id: Ifee2b4020b7630383dc32ef7590f8a9ccdaf49d2
diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp
index 4115c65..0104636 100644
--- a/camera/device/aidl/Android.bp
+++ b/camera/device/aidl/Android.bp
@@ -17,7 +17,7 @@
"android.hardware.common-V2",
"android.hardware.common.fmq-V1",
"android.hardware.camera.common-V1",
- "android.hardware.camera.metadata-V2",
+ "android.hardware.camera.metadata-V3",
"android.hardware.graphics.common-V5",
],
backend: {
diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl
index 542b296..9321ec0 100644
--- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl
+++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl
@@ -246,6 +246,7 @@
ANDROID_SENSOR_OPAQUE_RAW_SIZE_MAXIMUM_RESOLUTION,
ANDROID_SENSOR_PIXEL_MODE,
ANDROID_SENSOR_RAW_BINNING_FACTOR_USED,
+ ANDROID_SENSOR_READOUT_TIMESTAMP,
ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_SENSOR_INFO_START /* 983040 */,
ANDROID_SENSOR_INFO_SENSITIVITY_RANGE,
ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,
diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorReadoutTimestamp.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorReadoutTimestamp.aidl
new file mode 100644
index 0000000..35dc1a9
--- /dev/null
+++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorReadoutTimestamp.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *//*
+ * Autogenerated from camera metadata definitions in
+ * /system/media/camera/docs/metadata_definitions.xml
+ * *** DO NOT EDIT BY HAND ***
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.camera.metadata;
+@Backing(type="int") @VintfStability
+enum SensorReadoutTimestamp {
+ ANDROID_SENSOR_READOUT_TIMESTAMP_NOT_SUPPORTED,
+ ANDROID_SENSOR_READOUT_TIMESTAMP_HARDWARE,
+}
diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl
index 03cfba1..f133372 100644
--- a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl
+++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl
@@ -1591,6 +1591,13 @@
*/
ANDROID_SENSOR_RAW_BINNING_FACTOR_USED,
/**
+ * android.sensor.readoutTimestamp [static, enum, java_public]
+ *
+ * <p>Whether or not the camera device supports readout timestamp and
+ * {@code onReadoutStarted} callback.</p>
+ */
+ ANDROID_SENSOR_READOUT_TIMESTAMP,
+ /**
* android.sensor.info.activeArraySize [static, int32[], public]
*
* <p>The area of the image sensor which corresponds to active pixels after any geometric
diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/SensorReadoutTimestamp.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/SensorReadoutTimestamp.aidl
new file mode 100644
index 0000000..1678515
--- /dev/null
+++ b/camera/metadata/aidl/android/hardware/camera/metadata/SensorReadoutTimestamp.aidl
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Autogenerated from camera metadata definitions in
+ * /system/media/camera/docs/metadata_definitions.xml
+ * *** DO NOT EDIT BY HAND ***
+ */
+
+package android.hardware.camera.metadata;
+
+/**
+ * android.sensor.readoutTimestamp enumeration values
+ * @see ANDROID_SENSOR_READOUT_TIMESTAMP
+ */
+@VintfStability
+@Backing(type="int")
+enum SensorReadoutTimestamp {
+ ANDROID_SENSOR_READOUT_TIMESTAMP_NOT_SUPPORTED,
+ ANDROID_SENSOR_READOUT_TIMESTAMP_HARDWARE,
+}
diff --git a/camera/provider/aidl/vts/Android.bp b/camera/provider/aidl/vts/Android.bp
index f9305bb..1c106f6 100644
--- a/camera/provider/aidl/vts/Android.bp
+++ b/camera/provider/aidl/vts/Android.bp
@@ -61,7 +61,7 @@
"android.hardware.camera.common@1.0-helper",
"android.hardware.camera.common-V1-ndk",
"android.hardware.camera.device-V3-ndk",
- "android.hardware.camera.metadata-V2-ndk",
+ "android.hardware.camera.metadata-V3-ndk",
"android.hardware.camera.provider-V3-ndk",
"android.hidl.allocator@1.0",
"libgrallocusage",