Camera: Add new minor revision camera.device@3.3

This adds a single new member to the HalStream structure, used by
camera.device@3.2::ICameraDeviceSession.configureStreams, for
HALs to override the requested stream dataSpace.

This override may be used when the requested format is
IMPLEMENTATION_DEFINED.

Test: Builds
Bug: 62358514
Change-Id: Ie43e6cfd2ac52657c9366ff5297daa22c0bfa46c
diff --git a/camera/Android.bp b/camera/Android.bp
index 3869766..83a2803 100644
--- a/camera/Android.bp
+++ b/camera/Android.bp
@@ -6,6 +6,7 @@
     "device/1.0/default",
     "device/3.2",
     "device/3.2/default",
+    "device/3.3",
     "metadata/3.2",
     "provider/2.4",
     "provider/2.4/default",
diff --git a/camera/device/3.3/Android.bp b/camera/device/3.3/Android.bp
new file mode 100644
index 0000000..2a19991
--- /dev/null
+++ b/camera/device/3.3/Android.bp
@@ -0,0 +1,72 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+filegroup {
+    name: "android.hardware.camera.device@3.3_hal",
+    srcs: [
+        "types.hal",
+        "ICameraDeviceSession.hal",
+    ],
+}
+
+genrule {
+    name: "android.hardware.camera.device@3.3_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.camera.device@3.3",
+    srcs: [
+        ":android.hardware.camera.device@3.3_hal",
+    ],
+    out: [
+        "android/hardware/camera/device/3.3/types.cpp",
+        "android/hardware/camera/device/3.3/CameraDeviceSessionAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.camera.device@3.3_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.camera.device@3.3",
+    srcs: [
+        ":android.hardware.camera.device@3.3_hal",
+    ],
+    out: [
+        "android/hardware/camera/device/3.3/types.h",
+        "android/hardware/camera/device/3.3/hwtypes.h",
+        "android/hardware/camera/device/3.3/ICameraDeviceSession.h",
+        "android/hardware/camera/device/3.3/IHwCameraDeviceSession.h",
+        "android/hardware/camera/device/3.3/BnHwCameraDeviceSession.h",
+        "android/hardware/camera/device/3.3/BpHwCameraDeviceSession.h",
+        "android/hardware/camera/device/3.3/BsCameraDeviceSession.h",
+    ],
+}
+
+cc_library {
+    name: "android.hardware.camera.device@3.3",
+    defaults: ["hidl-module-defaults"],
+    generated_sources: ["android.hardware.camera.device@3.3_genc++"],
+    generated_headers: ["android.hardware.camera.device@3.3_genc++_headers"],
+    export_generated_headers: ["android.hardware.camera.device@3.3_genc++_headers"],
+    vendor_available: true,
+    vndk: {
+        enabled: true,
+    },
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "android.hardware.camera.common@1.0",
+        "android.hardware.camera.device@3.2",
+        "android.hardware.graphics.common@1.0",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "android.hardware.camera.common@1.0",
+        "android.hardware.camera.device@3.2",
+        "android.hardware.graphics.common@1.0",
+    ],
+}
diff --git a/camera/device/3.3/ICameraDeviceSession.hal b/camera/device/3.3/ICameraDeviceSession.hal
new file mode 100644
index 0000000..764392f
--- /dev/null
+++ b/camera/device/3.3/ICameraDeviceSession.hal
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+package android.hardware.camera.device@3.3;
+
+import android.hardware.camera.common@1.0::Status;
+import android.hardware.camera.device@3.2::ICameraDeviceSession;
+import android.hardware.camera.device@3.2::StreamConfiguration;
+
+/**
+ * Camera device active session interface.
+ *
+ * Obtained via ICameraDevice::open(), this interface contains the methods to
+ * configure and request captures from an active camera device.
+ *
+ */
+interface ICameraDeviceSession extends @3.2::ICameraDeviceSession {
+
+    /**
+     * configureStreams_3_3:
+     *
+     * Identical to @3.2::ICameraDeviceSession.configureStreams, except that:
+     *
+     * - The output HalStreamConfiguration now contains an overrideDataspace
+     *   field, to be used by the HAL to select a different dataspace for some
+     *   use cases when dealing with the IMPLEMENTATION_DEFINED pixel format.
+     *
+     * Clients may invoke either this method or
+     * @3.2::ICameraDeviceSession.configureStreams() for stream configuration.
+     * This method is recommended for clients to use since it provides more
+     * flexibility.
+     */
+    configureStreams_3_3(StreamConfiguration requestedConfiguration)
+            generates (Status status,
+                    @3.3::HalStreamConfiguration halConfiguration);
+
+};
diff --git a/camera/device/3.3/types.hal b/camera/device/3.3/types.hal
new file mode 100644
index 0000000..b4ad702
--- /dev/null
+++ b/camera/device/3.3/types.hal
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+package android.hardware.camera.device@3.3;
+
+import android.hardware.camera.device@3.2::DataspaceFlags;
+import android.hardware.camera.device@3.2::HalStream;
+
+/**
+ * HalStream:
+ *
+ * The camera HAL's response to each requested stream configuration.
+ *
+ * This version extends the @3.2 HalStream with the overrideDataspace
+ * field
+ */
+struct HalStream {
+    /**
+     * The definition of HalStream from the prior version.
+     */
+    @3.2::HalStream v3_2;
+
+    /**
+     * An override dataSpace for the buffers in this stream.
+     *
+     * The HAL must respect the requested dataSpace in Stream unless it is
+     * IMPLEMENTATION_DEFINED, in which case the override dataSpace here must be
+     * used by the client instead, for this stream. This allows cross-platform
+     * HALs to use a specific dataSpace since IMPLEMENTATION_DEFINED formats often
+     * require device-specific information for correct selection. In all other cases, the
+     * overrideFormat must match the requested format.
+     */
+    DataspaceFlags overrideDataSpace;
+};
+
+/**
+ * HalStreamConfiguration:
+ *
+ * Identical to @3.2::HalStreamConfiguration, except that it contains @3.3::HalStream entries.
+ *
+ */
+struct HalStreamConfiguration {
+    vec<HalStream> streams;
+};
diff --git a/camera/device/README.md b/camera/device/README.md
index 6e5703a..9f60781 100644
--- a/camera/device/README.md
+++ b/camera/device/README.md
@@ -33,6 +33,8 @@
 This HAL interface version only allows support at the LEGACY level for the
 android.hardware.camera2 API.
 
+Added in Android 8.0.
+
 Subsidiary HALs:
 
 #### ICameraDevice1PreviewCallback.hal@1.0:
@@ -62,6 +64,8 @@
 interface for operating the active camera. It takes a Callback interface as an
 argument.
 
+Added in Android 8.0.
+
 Subsidiary HALs:
 
 #### ICameraDevice3Session.hal@3.2:
@@ -74,3 +78,12 @@
 
 Callback interface for sending completed captures and other asynchronous events
 from tehe HAL to the client.
+
+### ICameraDevice.hal@3.3:
+
+A minor revision to the ICameraDevice.hal@3.2.
+
+  - Adds support for overriding the output dataspace of a stream, which was
+    supported in the legacy camera HAL.
+
+Added in Android 8.1.