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/Android.bp b/camera/device/1.0/Android.bp
new file mode 100644
index 0000000..6b13c1f
--- /dev/null
+++ b/camera/device/1.0/Android.bp
@@ -0,0 +1,76 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.camera.device@1.0_genc++",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.camera.device@1.0",
+ srcs: [
+ "types.hal",
+ "ICameraDevice.hal",
+ "ICameraDeviceCallback.hal",
+ "ICameraDevicePreviewCallback.hal",
+ ],
+ out: [
+ "android/hardware/camera/device/1.0/types.cpp",
+ "android/hardware/camera/device/1.0/CameraDeviceAll.cpp",
+ "android/hardware/camera/device/1.0/CameraDeviceCallbackAll.cpp",
+ "android/hardware/camera/device/1.0/CameraDevicePreviewCallbackAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.camera.device@1.0_genc++_headers",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.camera.device@1.0",
+ srcs: [
+ "types.hal",
+ "ICameraDevice.hal",
+ "ICameraDeviceCallback.hal",
+ "ICameraDevicePreviewCallback.hal",
+ ],
+ out: [
+ "android/hardware/camera/device/1.0/types.h",
+ "android/hardware/camera/device/1.0/ICameraDevice.h",
+ "android/hardware/camera/device/1.0/IHwCameraDevice.h",
+ "android/hardware/camera/device/1.0/BnCameraDevice.h",
+ "android/hardware/camera/device/1.0/BpCameraDevice.h",
+ "android/hardware/camera/device/1.0/BsCameraDevice.h",
+ "android/hardware/camera/device/1.0/ICameraDeviceCallback.h",
+ "android/hardware/camera/device/1.0/IHwCameraDeviceCallback.h",
+ "android/hardware/camera/device/1.0/BnCameraDeviceCallback.h",
+ "android/hardware/camera/device/1.0/BpCameraDeviceCallback.h",
+ "android/hardware/camera/device/1.0/BsCameraDeviceCallback.h",
+ "android/hardware/camera/device/1.0/ICameraDevicePreviewCallback.h",
+ "android/hardware/camera/device/1.0/IHwCameraDevicePreviewCallback.h",
+ "android/hardware/camera/device/1.0/BnCameraDevicePreviewCallback.h",
+ "android/hardware/camera/device/1.0/BpCameraDevicePreviewCallback.h",
+ "android/hardware/camera/device/1.0/BsCameraDevicePreviewCallback.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.camera.device@1.0",
+ generated_sources: ["android.hardware.camera.device@1.0_genc++"],
+ generated_headers: ["android.hardware.camera.device@1.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.camera.device@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "liblog",
+ "libutils",
+ "libcutils",
+ "android.hardware.camera.common@1.0",
+ "android.hardware.graphics.allocator@2.0",
+ "android.hardware.graphics.common@1.0",
+ ],
+ export_shared_lib_headers: [
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "libutils",
+ "android.hardware.camera.common@1.0",
+ "android.hardware.graphics.allocator@2.0",
+ "android.hardware.graphics.common@1.0",
+ ],
+}
diff --git a/camera/device/1.0/ICameraDevice.hal b/camera/device/1.0/ICameraDevice.hal
new file mode 100644
index 0000000..d232a67
--- /dev/null
+++ b/camera/device/1.0/ICameraDevice.hal
@@ -0,0 +1,389 @@
+/*
+ * 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 ICameraDeviceCallback;
+import ICameraDevicePreviewCallback;
+
+/**
+ * Camera device HAL, legacy version
+ *
+ * DEPRECATED. New devices are strongly recommended to use Camera HAL v3.2 or
+ * newer.
+ *
+ * Supports the android.hardware.Camera API, and the android.hardware.camera2
+ * API in LEGACY mode only.
+ *
+ * Will be removed in the Android P release.
+ */
+interface ICameraDevice {
+
+ /**
+ * Get camera device resource cost information.
+ *
+ * This method may be called at any time, including before open()
+ *
+ * @return status Status code for the operation, one of:
+ * OK:
+ * On success.
+ * INTERNAL_ERROR:
+ * An unexpected internal camera HAL error occurred, and the
+ * resource cost is not available.
+ * CAMERA_DISCONNECTED:
+ * An external camera device has been disconnected, and is no longer
+ * available. This camera device interface is now stale, and a new
+ * instance must be acquired if the device is reconnected. All
+ * subsequent calls on this interface must return
+ * CAMERA_DISCONNECTED.
+ * @return resourceCost
+ * The resources required to open this camera device, or unspecified
+ * values if status is not OK.
+ */
+ getResourceCost() generates (Status status, CameraResourceCost resourceCost);
+
+ /**
+ * Get basic camera information.
+ *
+ * This method may be called at any time, including before open()
+ *
+ * @return status Status code for the operation, one of:
+ * OK:
+ * On success.
+ * INTERNAL_ERROR:
+ * An unexpected internal camera HAL error occurred, and the
+ * camera information is not available.
+ * CAMERA_DISCONNECTED:
+ * An external camera device has been disconnected, and is no longer
+ * available. This camera device interface is now stale, and a new
+ * instance must be acquired if the device is reconnected. All
+ * subsequent calls on this interface must return
+ * CAMERA_DISCONNECTED.
+ * @return info Basic information about this camera device, or unspecified
+ * values if status is not OK.
+ */
+ getCameraInfo() generates (Status status, CameraInfo info);
+
+ /**
+ * setTorchMode:
+ *
+ * Turn on or off the torch mode of the flash unit associated with a given
+ * camera ID. If the operation is successful, HAL must notify the framework
+ * torch state by invoking
+ * ICameraProviderCallback::torchModeStatusChange() with the new state.
+ *
+ * The camera device has a higher priority accessing the flash unit. When
+ * there are any resource conflicts, such as when open() is called to fully
+ * activate a camera device, the provider must notify the framework through
+ * ICameraProviderCallback::torchModeStatusChange() that the torch mode has
+ * been turned off and the torch mode state has become
+ * TORCH_MODE_STATUS_NOT_AVAILABLE. When resources to turn on torch mode
+ * become available again, the provider must notify the framework through
+ * ICameraProviderCallback::torchModeStatusChange() that the torch mode
+ * state has become TORCH_MODE_STATUS_AVAILABLE_OFF for set_torch_mode() to
+ * be called.
+ *
+ * When the framework calls setTorchMode() to turn on the torch mode of a
+ * flash unit, if HAL cannot keep multiple torch modes on simultaneously,
+ * HAL must turn off the torch mode that was turned on by
+ * a previous setTorchMode() call and notify the framework that the torch
+ * mode state of that flash unit has become TORCH_MODE_STATUS_AVAILABLE_OFF.
+ *
+ * @param torchMode The new mode to set the device flash unit to.
+ *
+ * @return status Status code for the operation, one of:
+ * OK:
+ * On a successful change to the torch state.
+ * INTERNAL_ERROR:
+ * The flash unit cannot be operated due to an unexpected internal
+ * error.
+ * ILLEGAL_ARGUMENT:
+ * The camera ID is unknown.
+ * CAMERA_IN_USE:
+ * This camera device has been opened, so the torch cannot be
+ * controlled until it is closed.
+ * MAX_CAMERAS_IN_USE:
+ * Due to other camera devices being open, or due to other
+ * resource constraints, the torch cannot be controlled currently.
+ * METHOD_NOT_SUPPORTED:
+ * This provider does not support direct operation of flashlight
+ * torch mode. The framework must open the camera device and turn
+ * the torch on through the device interface.
+ * OPERATION_NOT_SUPPORTED:
+ * This camera device does not have a flash unit. This must
+ * be returned if and only if android.flash.info.available is
+ * false.
+ * CAMERA_DISCONNECTED:
+ * An external camera device has been disconnected, and is no longer
+ * available. This camera device interface is now stale, and a new
+ * instance must be acquired if the device is reconnected. All
+ * subsequent calls on this interface must return
+ * CAMERA_DISCONNECTED.
+ *
+ */
+ setTorchMode(TorchMode mode) generates (Status status);
+
+ /**
+ * Dump state of the camera hardware.
+ *
+ * This must be callable at any time, whether the device is open or not.
+ *
+ * @param fd A native handle with one valid file descriptor. The descriptor
+ * must be able to be used with dprintf() or equivalent to dump the
+ * state of this camera device into the camera service dumpsys output.
+ *
+ * @return status The status code for this operation.
+ */
+ dumpState(handle fd) generates (Status status);
+
+ /**
+ * Open the camera device for active use.
+ *
+ * All methods besides getResourceCost(), getCameraInfo(), setTorchMode(),
+ * and dump() must not be called unless open() has been called successfully,
+ * and close() has not yet been called.
+ *
+ * @param callback Interface to invoke by the HAL for device callbacks.
+ * @return status Status code for the operation, one of:
+ * OK:
+ * On a successful open of the camera device.
+ * INTERNAL_ERROR:
+ * The camera device cannot be opened due to an internal
+ * error.
+ * ILLEGAL_ARGUMENT:
+ * The callback handle is invalid (for example, it is null).
+ * CAMERA_IN_USE:
+ * This camera device is already open.
+ * MAX_CAMERAS_IN_USE:
+ * The maximal number of camera devices that can be
+ * opened concurrently were opened already.
+ * CAMERA_DISCONNECTED:
+ * This external camera device has been disconnected, and is no
+ * longer available. This interface is now stale, and a new instance
+ * must be acquired if the device is reconnected. All subsequent
+ * calls on this interface must return CAMERA_DISCONNECTED.
+ */
+ open(ICameraDeviceCallback callback) generates (Status status);
+
+
+ /*****
+ * All methods below this point must only be called between a successful
+ * open() call and a close() call.
+ */
+
+ /** Set the callback interface through which preview frames are sent */
+ setPreviewWindow(ICameraDevicePreviewCallback window)
+ generates (Status status);
+
+ /**
+ * Enable a message, or set of messages.
+ *
+ * @param msgType The bitfield of messages to enable.
+ */
+ enableMsgType(FrameCallbackFlags msgType);
+
+ /**
+ * Disable a message, or a set of messages.
+ *
+ * Once received a call to disableMsgType(CAMERA_MSG_VIDEO_FRAME), camera
+ * HAL must not rely on its client to call releaseRecordingFrame() to
+ * release video recording frames sent out by the cameral HAL before and
+ * after the disableMsgType(CAMERA_MSG_VIDEO_FRAME) call. Camera HAL
+ * clients must not modify/access any video recording frame after calling
+ * disableMsgType(CAMERA_MSG_VIDEO_FRAME).
+ *
+ * @param msgType The bitfield of messages to disable.
+ */
+ disableMsgType(FrameCallbackFlags msgType);
+
+ /**
+ * Query whether a message, or a set of messages, is enabled. Note that
+ * this is operates as an AND, if any of the messages queried are off, this
+ * must return false.
+ *
+ * @param msgType The bitfield of messages to query.
+ * @return enabled Whether all the specified flags are enabled.
+ */
+ msgTypeEnabled(FrameCallbackFlags msgType) generates (bool enabled);
+
+ /**
+ * Start preview mode.
+ *
+ * @return status The status code for this operation.
+ */
+ startPreview() generates (Status status);
+
+ /**
+ * Stop a previously started preview.
+ */
+ stopPreview();
+
+ /**
+ * Returns true if preview is enabled.
+ *
+ * @return enabled Whether preview is currently enabled.
+ */
+ previewEnabled() generates (bool enabled);
+
+ /**
+ * Request the camera HAL to store meta data or real YUV data in the video
+ * buffers sent out via CAMERA_MSG_VIDEO_FRAME for a recording session. If
+ * it is not called, the default camera HAL behavior is to store real YUV
+ * data in the video buffers.
+ *
+ * This method must be called before startRecording() in order to be
+ * effective.
+ *
+ * If meta data is stored in the video buffers, it is up to the receiver of
+ * the video buffers to interpret the contents and to find the actual frame
+ * data with the help of the meta data in the buffer. How this is done is
+ * outside of the scope of this method.
+ *
+ * Some camera HALs may not support storing meta data in the video buffers,
+ * but all camera HALs must support storing real YUV data in the video
+ * buffers. If the camera HAL does not support storing the meta data in the
+ * video buffers when it is requested to do do, INVALID_OPERATION must be
+ * returned. It is very useful for the camera HAL to pass meta data rather
+ * than the actual frame data directly to the video encoder, since the
+ * amount of the uncompressed frame data can be very large if video size is
+ * large.
+ *
+ * @param enable Set to true to instruct the camera HAL to store meta data
+ * in the video buffers; false to instruct the camera HAL to store real
+ * YUV data in the video buffers.
+ *
+ * @return status OK on success.
+ */
+ storeMetaDataInBuffers(bool enable) generates (Status status);
+
+ /**
+ * Start record mode.
+ *
+ * When a record image is available, a CAMERA_MSG_VIDEO_FRAME message is
+ * sent with the corresponding frame. Every record frame must be released by
+ * a camera HAL client via releaseRecordingFrame() before the client calls
+ * disableMsgType(CAMERA_MSG_VIDEO_FRAME). After the client calls
+ * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's
+ * responsibility to manage the life-cycle of the video recording frames,
+ * and the client must not modify/access any video recording frames.
+ *
+ * @return status The status code for the operation.
+ */
+ startRecording() generates (Status status);
+
+ /**
+ * Stop a previously started recording.
+ */
+ stopRecording();
+
+ /**
+ * Returns true if recording is enabled.
+ *
+ * @return enabled True if recording is currently active.
+ */
+ recordingEnabled() generates (bool enabled);
+
+ /**
+ * Release a record frame previously returned by CAMERA_MSG_VIDEO_FRAME.
+ *
+ * It is camera HAL client's responsibility to release video recording
+ * frames sent out by the camera HAL before the camera HAL receives a call
+ * to disableMsgType(CAMERA_MSG_VIDEO_FRAME). After it receives the call to
+ * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's
+ * responsibility to manage the life-cycle of the video recording frames.
+ *
+ * @param data The memory buffer to release a recording frame from.
+ * @param bufferIndex The specific buffer index to return to the HAL.
+ */
+ releaseRecordingFrame(MemoryId data, uint32_t bufferIndex);
+
+ /**
+ * Start auto focus.
+ *
+ * The notification callback routine is called with
+ * CAMERA_MSG_FOCUS once when focusing is complete. autoFocus() can be
+ * called again after that if another auto focus is needed.
+ *
+ * @return status The status code for this operation.
+ */
+ autoFocus() generates (Status status);
+
+ /**
+ * Cancels auto-focus function.
+ *
+ * If the auto-focus is still in progress, this function must cancel
+ * it. Whether the auto-focus is in progress or not, this function must
+ * return the focus position to the default. If the camera does not support
+ * auto-focus, this is a no-op.
+ *
+ * @return status The status code for this operation.
+ */
+ cancelAutoFocus() generates (Status status);
+
+ /**
+ * Take a picture.
+ *
+ * @return status The status code for this operation.
+ */
+ takePicture() generates (Status status);
+
+ /**
+ * Cancel a picture that was started with takePicture. Calling this method
+ * when no picture is being taken is a no-op.
+ *
+ * @return status The status code for this operation.
+ */
+ cancelPicture() generates (Status status);
+
+ /**
+ * Set the camera parameters.
+ *
+ * @param parms The parameter string, consisting of
+ * '<key1>=<value1>; ...;<keyN>=<valueN>'.
+ * @return status The status code for this operation:
+ * OK: Parameter update was successful
+ * ILLEGAL_ARGUMENT: At least one parameter was invalid or not supported
+ *
+ */
+ setParameters(string parms) generates (Status status);
+
+ /**
+ * Retrieve the camera parameters.
+ */
+ getParameters() generates (string parms);
+
+ /**
+ * Send command to camera driver.
+ * The meaning of the arguments is defined by the value of cmd, documented
+ * in the CommandType definition.
+ *
+ * @param cmd The command to invoke.
+ * @param arg1 The first argument for the command, if needed.
+ * @param arg2 The second argument for the command, if needed.
+ *
+ * @return status The status code for this operation.
+ */
+ sendCommand(CommandType cmd, int32_t arg1, int32_t arg2)
+ generates (Status status);
+
+ /**
+ * Release the hardware resources owned by this object, shutting down the
+ * camera device.
+ */
+ close();
+
+};
diff --git a/camera/device/1.0/ICameraDeviceCallback.hal b/camera/device/1.0/ICameraDeviceCallback.hal
new file mode 100644
index 0000000..97014ee
--- /dev/null
+++ b/camera/device/1.0/ICameraDeviceCallback.hal
@@ -0,0 +1,81 @@
+/*
+ * 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;
+
+interface ICameraDeviceCallback {
+
+ /**
+ * Notify the camera service of a particular event occurring
+ * The meaning of each parameter is defined by the value of msgType, and
+ * documented in the definition of NotifyCallbackMsg.
+ *
+ * @param msgType The type of the event.
+ * @param ext1 The first parameter for the event, if needed.
+ * @param ext2 The second parameter for the event, if needed.
+ */
+ notifyCallback(NotifyCallbackMsg msgType, int32_t ext1, int32_t ext2);
+
+ /**
+ * Define a memory buffer from the provided handle and size, and return a
+ * unique identifier for the HAL to use to reference it with.
+ *
+ * TODO(b/33269977): Ensure this aligns with design and performance goals.
+ *
+ * @param descriptor A native handle that must have exactly one file
+ * descriptor in it; the file descriptor must be memory mappable to
+ * bufferSize * bufferCount bytes.
+ * @param bufferSize The number of bytes a single buffer consists of.
+ * @param bufferCount The number of contiguous buffers that the descriptor
+ * contains.
+ *
+ * @return memId A integer identifier for this memory buffer, for use with
+ * data callbacks and unregistering memory.
+ */
+ registerMemory(handle descriptor, uint32_t bufferSize, uint32_t bufferCount)
+ generates (MemoryId memId);
+
+ /**
+ * Unregister a previously registered memory buffer
+ */
+ unregisterMemory(MemoryId memId);
+
+ /**
+ * Send a buffer of image data to the camera service
+ *
+ * @param msgType The kind of image buffer data this call represents.
+ * @param data A memory handle to the buffer containing the data.
+ * @param bufferIndex The offset into the memory handle where the buffer
+ * starts.
+ *
+ */
+ dataCallback(DataCallbackMsg msgType, MemoryId data, uint32_t bufferIndex);
+
+ /**
+ * Send a buffer of image data to the camera service, with a timestamp
+ *
+ * @param msgType The kind of image buffer data this call represents.
+ * @param data A memory handle to the buffer containing the data.
+ * @param bufferIndex The offset into the memory handle where the buffer
+ * starts.
+ * @param timestamp The time this buffer was captured by the camera, in
+ * nanoseconds.
+ *
+ */
+ dataCallbackTimestamp(DataCallbackMsg msgType, MemoryId data, uint32_t bufferIndex,
+ int64_t timestamp);
+
+};
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);
+
+};
diff --git a/camera/device/1.0/types.hal b/camera/device/1.0/types.hal
new file mode 100644
index 0000000..4e5683a
--- /dev/null
+++ b/camera/device/1.0/types.hal
@@ -0,0 +1,194 @@
+/*
+ * 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;
+
+enum CameraFacing : uint32_t {
+ /** The facing of the camera is opposite to that of the screen. */
+ BACK = 0,
+ /** The facing of the camera is the same as that of the screen. */
+ FRONT = 1,
+ /**
+ * The facing of the camera is not fixed relative to the screen.
+ * The cameras with this facing are external cameras, e.g. USB cameras.
+ */
+ EXTERNAL = 2
+};
+
+/**
+ * Basic information about a camera device, always accessible via
+ * ICameraDevice::getCameraInfo().
+ */
+struct CameraInfo {
+ /**
+ * The direction that this device faces.
+ */
+ CameraFacing facing;
+
+ /**
+ * The orientation of the camera image. The value is the angle that the
+ * camera image needs to be rotated clockwise so it shows correctly on the
+ * display in its natural orientation. It must be 0, 90, 180, or 270.
+ *
+ * For example, suppose a device has a naturally tall screen. The
+ * back-facing camera sensor is mounted in landscape. You are looking at the
+ * screen. If the top side of the camera sensor is aligned with the right
+ * edge of the screen in natural orientation, the value must be 90. If the
+ * top side of a front-facing camera sensor is aligned with the right of the
+ * screen, the value must be 270.
+ *
+ * An external camera device must leave this set to 0.
+ *
+ */
+ uint32_t orientation;
+
+};
+
+/**
+ * Message types for ICameraDevice@1.0::enableMsgType()/disableMsgType()
+ *
+ * A set of bit masks for specifying how the received preview frames are
+ * handled before the previewCallback() call.
+ *
+ * The least significant 3 bits of an "int" value are used for this purpose:
+ *
+ * ..... 0 0 0
+ * ^ ^ ^
+ * | | |---------> determine whether the callback is enabled or not
+ * | |-----------> determine whether the callback is one-shot or not
+ * |-------------> determine whether the frame is copied out or not
+ *
+ * WARNING: When a frame is sent directly without copying, it is the frame
+ * receiver's responsiblity to make sure that the frame data won't get
+ * corrupted by subsequent preview frames filled by the camera. This flag is
+ * recommended only when copying out data brings significant performance price
+ * and the handling/processing of the received frame data is always faster than
+ * the preview frame rate so that data corruption won't occur.
+ *
+ * For instance,
+ * 1. 0x00 disables the callback. In this case, copy out and one shot bits
+ * are ignored.
+ * 2. 0x01 enables a callback without copying out the received frames. A
+ * typical use case is the Camcorder application to avoid making costly
+ * frame copies.
+ * 3. 0x05 is enabling a callback with frame copied out repeatedly. A typical
+ * use case is the Camera application.
+ * 4. 0x07 is enabling a callback with frame copied out only once. A typical
+ * use case is the Barcode scanner application.
+ */
+enum FrameCallbackFlags : uint32_t {
+ ENABLE_MASK = 0x01,
+ ONE_SHOT_MASK = 0x02,
+ COPY_OUT_MASK = 0x04,
+ /** Typical use cases */
+ NOOP = 0x00,
+ CAMCORDER = 0x01,
+ CAMERA = 0x05,
+ BARCODE_SCANNER = 0x07
+};
+
+/**
+ * Subset of commands in /system/core/include/system/camera.h relevant for
+ * ICameraDevice@1.0::sendCommand()
+ */
+enum CommandType : uint32_t {
+ START_SMOOTH_ZOOM = 1,
+ STOP_SMOOTH_ZOOM = 2,
+
+ /**
+ * Start the face detection. This must be called only after preview is
+ * started. The camera must notify the listener of CAMERA_MSG_FACE and the
+ * detected faces in the preview frame. The detected faces may be the same
+ * as the previous ones. Apps must call CAMERA_CMD_STOP_FACE_DETECTION to
+ * stop the face detection. This method is supported if CameraParameters
+ * KEY_MAX_NUM_HW_DETECTED_FACES or KEY_MAX_NUM_SW_DETECTED_FACES is bigger
+ * than 0. Hardware and software face detection must not be running at the
+ * same time. If the face detection has started, apps must not send this
+ * again.
+ *
+ * In hardware face detection mode, CameraParameters KEY_WHITE_BALANCE,
+ * KEY_FOCUS_AREAS and KEY_METERING_AREAS have no effect.
+ *
+ * arg1 is the face detection type. It can be CAMERA_FACE_DETECTION_HW or
+ * CAMERA_FACE_DETECTION_SW. If the type of face detection requested is not
+ * supported, the HAL must return BAD_VALUE.
+ */
+ START_FACE_DETECTION = 6,
+
+ /**
+ * Stop the face detection.
+ */
+ STOP_FACE_DETECTION = 7,
+
+ /**
+ * Enable/disable focus move callback (CAMERA_MSG_FOCUS_MOVE). Passing
+ * arg1 = 0 must disable, while passing arg1 = 1 must enable the callback.
+ */
+ ENABLE_FOCUS_MOVE_MSG = 8,
+
+ /**
+ * Configure an explicit format to use for video recording metadata mode.
+ * This can be used to switch the format from the
+ * default IMPLEMENTATION_DEFINED gralloc format to some other
+ * device-supported format, and the default dataspace from the BT_709 color
+ * space to some other device-supported dataspace. arg1 is the HAL pixel
+ * format, and arg2 is the HAL dataSpace. This command returns
+ * INVALID_OPERATION error if it is sent after video recording is started,
+ * or the command is not supported at all.
+ *
+ * If the gralloc format is set to a format other than
+ * IMPLEMENTATION_DEFINED, then HALv3 devices must use gralloc usage flags
+ * of SW_READ_OFTEN.
+ */
+ SET_VIDEO_FORMAT = 11
+};
+
+/**
+ * Message types for ICameraDevice1Callback::notifyCallback()
+ */
+enum NotifyCallbackMsg : uint32_t {
+ ERROR = 0x0001,
+ SHUTTER = 0x0002,
+ FOCUS = 0x0004,
+ ZOOM = 0x0008,
+ // Notify on autofocus start and stop. This is useful in continuous
+ // autofocus - FOCUS_MODE_CONTINUOUS_VIDEO and FOCUS_MODE_CONTINUOUS_PICTURE.
+ FOCUS_MOVE = 0x0800
+};
+
+/**
+ * Message types for ICameraDevice1Callback::dataCallback() and
+ * ICameraDevice1Callback::dataCallbackTimestamp()
+ */
+enum DataCallbackMsg : uint32_t {
+ PREVIEW_FRAME = 0x0010,
+ VIDEO_FRAME = 0x0020,
+ POSTVIEW_FRAME = 0x0040,
+ RAW_IMAGE = 0x0080,
+ COMPRESSED_IMAGE = 0x0100,
+ RAW_IMAGE_NOTIFY = 0x0200,
+ // Preview frame metadata. This can be combined with
+ // CAMERA_MSG_PREVIEW_FRAME in dataCallback. For example, the apps can
+ // request FRAME and METADATA. Or the apps can request only FRAME or only
+ // METADATA.
+ PREVIEW_METADATA = 0x0400
+};
+
+/*
+ * A simple integer handle to use to reference a particular memory buffer
+ * between the HAL and the framework.
+ */
+typedef uint32_t MemoryId;