Camera: HIDLized camera HALs, first set

* Common camera definitions (camera.common/1.0)
  * Basic status codes, shared types
* Provider 2.4 API (camera.provider/2.4), including vendor tag APIs
  * Enumerate and acquire camera device instances
  * Mostly equivalent to legacy camera module v2.4.
* Device 1.0 API (camera.device/1.0)
  * Mostly equivalent to legacy camera HAL v1.0.
* Device 3.2 API (camera.device/3.2)
  * Mostly equivalent to legacy camera HAL v3.2.
* Metadata 3.2 API (camera.metadata/3.2)
  * Definitions for valid metadata fields for device 3.2

Only the key initial interfaces are added; default implementations are
in a later CL. Other interfaces that will likely need to be added:

* Other provider minor versions
* Other device 3.x minor versions

Test: make -j32
Bug: 30985004
Bug: 32991603
Change-Id: I1c6a9a269bf45276055707bbc58cfc50d29fa919
diff --git a/camera/device/1.0/ICameraDevicePreviewCallback.hal b/camera/device/1.0/ICameraDevicePreviewCallback.hal
new file mode 100644
index 0000000..ebc7460
--- /dev/null
+++ b/camera/device/1.0/ICameraDevicePreviewCallback.hal
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2016 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@1.0;
+
+import android.hardware.camera.common@1.0::types;
+import android.hardware.graphics.allocator@2.0::types;
+import android.hardware.graphics.common@1.0::types;
+
+/**
+ * Camera device HAL@1.0 preview stream operation interface.
+ */
+interface ICameraDevicePreviewCallback {
+
+    /**
+     * Acquire a buffer to write a preview buffer into.
+     *
+     * @return status The status code for this operation. If not OK, then
+     *     buffer and stride must not be used.
+     * @return buffer A handle to the buffer to write into.
+     * @return stride The stride between two rows of pixels in this buffer.
+     */
+    dequeueBuffer() generates (Status status, handle buffer, uint32_t stride);
+
+    /**
+     * Send a filled preview buffer to its consumer.
+     *
+     * @param buffer The handle to the preview buffer that's been filled.
+     * @return status The status code for this operation.
+     */
+    enqueueBuffer(handle buffer) generates (Status status);
+
+    /**
+     * Return a preview buffer unfilled. This buffer must not be sent on to the
+     * preview consumer as a valid buffer, but may be reused as if it were
+     * empty.
+     *
+     * @param buffer The handle to the preview buffer to return.
+     * @return status The status code for this operation.
+     */
+    cancelBuffer(handle buffer) generates (Status status);
+
+    /**
+     * Set the number of preview buffers needed by the HAL.
+     *
+     * @param count The maximum number of preview buffers to allocate.
+     * @return status The status code for this operation.
+     */
+    setBufferCount(uint32_t count) generates (Status status);
+
+    /**
+     * Set the dimensions and format of future preview buffers.
+     *
+     * The next buffer that is dequeued must match the requested size and
+     * format.
+     *
+     * @return Status The status code for this operation.
+     */
+    setBuffersGeometry(uint32_t w, uint32_t h,
+            android.hardware.graphics.common@1.0::PixelFormat format)
+            generates (Status status);
+
+    /**
+     * Set the valid region of image data for the next buffer(s) to be enqueued.
+     *
+     * @return Status The status code for this operation.
+     */
+    setCrop(int32_t left, int32_t top, int32_t right, int32_t bottom)
+            generates (Status status);
+
+    /**
+     * Set the producer usage flags for the next buffer(s) to be enqueued.
+     *
+     * @return Status The status code for this operation.
+     */
+    setUsage(ProducerUsage usage) generates (Status status);
+
+    /**
+     * Set the expected buffering mode for the preview output.
+     */
+    setSwapInterval(int32_t interval) generates (Status status);
+
+    /**
+     * Get the minimum number of buffers the preview consumer endpoint needs
+     * to hold for correct operation.
+     *
+     * @return Status The status code for this operation.
+     * @return count The number of buffers the consumer has requested.
+     */
+    getMinUndequeuedBufferCount() generates (Status status, uint32_t count);
+
+    /**
+     * Set the timestamp for the next buffer to enqueue
+     *
+     * Timestamps are measured in nanoseconds, and must be comparable
+     * and monotonically increasing between two frames in the same
+     * preview stream. They do not need to be comparable between
+     * consecutive or parallel preview streams, cameras, or app runs.
+     *
+     * @param timestamp The timestamp to set for future buffers.
+     * @return Status The status code for this operation.
+     */
+    setTimestamp(int64_t timestamp) generates (Status status);
+
+};