18486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He/*
28486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * Copyright (C) 2016 The Android Open Source Project
38486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He *
48486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * Licensed under the Apache License, Version 2.0 (the "License");
58486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * you may not use this file except in compliance with the License.
68486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * You may obtain a copy of the License at
78486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He *
88486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He *      http://www.apache.org/licenses/LICENSE-2.0
98486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He *
108486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * Unless required by applicable law or agreed to in writing, software
118486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * distributed under the License is distributed on an "AS IS" BASIS,
128486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
138486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * See the License for the specific language governing permissions and
148486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * limitations under the License.
158486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He */
168486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
178486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun Hepackage android.hardware.camera.device@1.0;
188486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
198486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun Heimport android.hardware.camera.common@1.0::types;
208486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun Heimport ICameraDeviceCallback;
218486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun Heimport ICameraDevicePreviewCallback;
228486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
238486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He/**
248486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * Camera device HAL, legacy version
258486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He *
268486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * DEPRECATED. New devices are strongly recommended to use Camera HAL v3.2 or
278486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * newer.
288486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He *
298486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * Supports the android.hardware.Camera API, and the android.hardware.camera2
308486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * API in LEGACY mode only.
318486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He *
328486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He * Will be removed in the Android P release.
338486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He */
348486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun Heinterface ICameraDevice {
358486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
368486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
378486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Get camera device resource cost information.
388486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
398486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * This method may be called at any time, including before open()
408486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
418486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status Status code for the operation, one of:
428486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     OK:
438486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         On success.
448486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     INTERNAL_ERROR:
458486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         An unexpected internal camera HAL error occurred, and the
468486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         resource cost is not available.
478486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     CAMERA_DISCONNECTED:
488486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         An external camera device has been disconnected, and is no longer
498486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         available. This camera device interface is now stale, and a new
508486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         instance must be acquired if the device is reconnected. All
518486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         subsequent calls on this interface must return
528486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         CAMERA_DISCONNECTED.
538486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return resourceCost
548486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     The resources required to open this camera device, or unspecified
558486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     values if status is not OK.
568486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
578486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    getResourceCost() generates (Status status, CameraResourceCost resourceCost);
588486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
598486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
608486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Get basic camera information.
618486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
628486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * This method may be called at any time, including before open()
638486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
648486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status Status code for the operation, one of:
658486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     OK:
668486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         On success.
678486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     INTERNAL_ERROR:
688486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         An unexpected internal camera HAL error occurred, and the
698486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         camera information is not available.
708486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     CAMERA_DISCONNECTED:
718486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         An external camera device has been disconnected, and is no longer
728486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         available. This camera device interface is now stale, and a new
738486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         instance must be acquired if the device is reconnected. All
748486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         subsequent calls on this interface must return
758486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         CAMERA_DISCONNECTED.
768486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return info Basic information about this camera device, or unspecified
778486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     values if status is not OK.
788486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
798486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    getCameraInfo() generates (Status status, CameraInfo info);
808486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
818486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
828486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * setTorchMode:
838486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
848486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Turn on or off the torch mode of the flash unit associated with a given
858486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * camera ID. If the operation is successful, HAL must notify the framework
868486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * torch state by invoking
878486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * ICameraProviderCallback::torchModeStatusChange() with the new state.
888486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
898486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * The camera device has a higher priority accessing the flash unit. When
908486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * there are any resource conflicts, such as when open() is called to fully
918486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * activate a camera device, the provider must notify the framework through
928486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * ICameraProviderCallback::torchModeStatusChange() that the torch mode has
938486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * been turned off and the torch mode state has become
948486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * TORCH_MODE_STATUS_NOT_AVAILABLE. When resources to turn on torch mode
958486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * become available again, the provider must notify the framework through
968486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * ICameraProviderCallback::torchModeStatusChange() that the torch mode
978486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * state has become TORCH_MODE_STATUS_AVAILABLE_OFF for set_torch_mode() to
988486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * be called.
998486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
1008486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * When the framework calls setTorchMode() to turn on the torch mode of a
1018486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * flash unit, if HAL cannot keep multiple torch modes on simultaneously,
1028486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * HAL must turn off the torch mode that was turned on by
1038486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * a previous setTorchMode() call and notify the framework that the torch
1048486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * mode state of that flash unit has become TORCH_MODE_STATUS_AVAILABLE_OFF.
1058486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
1068486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @param torchMode The new mode to set the device flash unit to.
1078486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
1088486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status Status code for the operation, one of:
1098486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     OK:
1108486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         On a successful change to the torch state.
1118486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     INTERNAL_ERROR:
1128486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         The flash unit cannot be operated due to an unexpected internal
1138486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         error.
1148486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     ILLEGAL_ARGUMENT:
1158486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         The camera ID is unknown.
1168486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     CAMERA_IN_USE:
1178486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         This camera device has been opened, so the torch cannot be
1188486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         controlled until it is closed.
1198486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     MAX_CAMERAS_IN_USE:
1208486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         Due to other camera devices being open, or due to other
1218486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         resource constraints, the torch cannot be controlled currently.
1228486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     METHOD_NOT_SUPPORTED:
1238486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         This provider does not support direct operation of flashlight
1248486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         torch mode. The framework must open the camera device and turn
1258486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         the torch on through the device interface.
1268486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     OPERATION_NOT_SUPPORTED:
1278486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         This camera device does not have a flash unit. This must
1288a2a97a8ee09614bd4d9a8871be62a4cc858ce01Eino-Ville Talvala     *         be returned if and only if parameter key flash-mode-values is not present.
1298486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     CAMERA_DISCONNECTED:
1308486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         An external camera device has been disconnected, and is no longer
1318486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         available. This camera device interface is now stale, and a new
1328486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         instance must be acquired if the device is reconnected. All
1338486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         subsequent calls on this interface must return
1348486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         CAMERA_DISCONNECTED.
1358486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
1368486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
1378486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    setTorchMode(TorchMode mode) generates (Status status);
1388486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
1398486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
1408486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Dump state of the camera hardware.
1418486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
1428486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * This must be callable at any time, whether the device is open or not.
1438486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
1448486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @param fd A native handle with one valid file descriptor. The descriptor
1458486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     must be able to be used with dprintf() or equivalent to dump the
1468486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     state of this camera device into the camera service dumpsys output.
1478486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
1488486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status The status code for this operation.
1498486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
1508486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    dumpState(handle fd) generates (Status status);
1518486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
1528486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
1538486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Open the camera device for active use.
1548486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
1558486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * All methods besides getResourceCost(), getCameraInfo(), setTorchMode(),
1568486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * and dump() must not be called unless open() has been called successfully,
1578486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * and close() has not yet been called.
1588486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
1598486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @param callback Interface to invoke by the HAL for device callbacks.
1608486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status Status code for the operation, one of:
1618486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     OK:
1628486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         On a successful open of the camera device.
1638486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     INTERNAL_ERROR:
1648486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         The camera device cannot be opened due to an internal
1658486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         error.
1668486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     ILLEGAL_ARGUMENT:
1678486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         The callback handle is invalid (for example, it is null).
1688486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     CAMERA_IN_USE:
1698486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         This camera device is already open.
1708486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     MAX_CAMERAS_IN_USE:
1718486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         The maximal number of camera devices that can be
1728486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         opened concurrently were opened already.
1738486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     CAMERA_DISCONNECTED:
1748486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         This external camera device has been disconnected, and is no
1758486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         longer available. This interface is now stale, and a new instance
1768486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         must be acquired if the device is reconnected. All subsequent
1778486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *         calls on this interface must return CAMERA_DISCONNECTED.
1788486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
1798486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    open(ICameraDeviceCallback callback) generates (Status status);
1808486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
1818486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
1828486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /*****
1838486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * All methods below this point must only be called between a successful
1848486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * open() call and a close() call.
1858486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
1868486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
1878486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /** Set the callback interface through which preview frames are sent */
1888486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    setPreviewWindow(ICameraDevicePreviewCallback window)
1898486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He            generates (Status status);
1908486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
1918486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
1928486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Enable a message, or set of messages.
1938486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
1948486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @param msgType The bitfield of messages to enable.
1958486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
1968486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    enableMsgType(FrameCallbackFlags msgType);
1978486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
1988486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
1998486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Disable a message, or a set of messages.
2008486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
2018486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Once received a call to disableMsgType(CAMERA_MSG_VIDEO_FRAME), camera
2028486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * HAL must not rely on its client to call releaseRecordingFrame() to
2038486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * release video recording frames sent out by the cameral HAL before and
2048486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * after the disableMsgType(CAMERA_MSG_VIDEO_FRAME) call. Camera HAL
2058486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * clients must not modify/access any video recording frame after calling
2068486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * disableMsgType(CAMERA_MSG_VIDEO_FRAME).
2078486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
2088486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @param msgType The bitfield of messages to disable.
2098486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
2108486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    disableMsgType(FrameCallbackFlags msgType);
2118486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
2128486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
2138486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Query whether a message, or a set of messages, is enabled. Note that
2148486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * this is operates as an AND, if any of the messages queried are off, this
2158486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * must return false.
2168486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
2178486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @param msgType The bitfield of messages to query.
2188486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return enabled Whether all the specified flags are enabled.
2198486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
2208486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    msgTypeEnabled(FrameCallbackFlags msgType) generates (bool enabled);
2218486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
2228486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
2238486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Start preview mode.
2248486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
2258486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status The status code for this operation.
2268486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
2278486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    startPreview() generates (Status status);
2288486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
2298486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
2308486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Stop a previously started preview.
2318486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
2328486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    stopPreview();
2338486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
2348486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
2358486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Returns true if preview is enabled.
2368486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
2378486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return enabled Whether preview is currently enabled.
2388486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
2398486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    previewEnabled() generates (bool enabled);
2408486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
2418486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
2428486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Request the camera HAL to store meta data or real YUV data in the video
2438486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * buffers sent out via CAMERA_MSG_VIDEO_FRAME for a recording session. If
2448486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * it is not called, the default camera HAL behavior is to store real YUV
2458486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * data in the video buffers.
2468486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
2478486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * This method must be called before startRecording() in order to be
2488486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * effective.
2498486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
2508486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * If meta data is stored in the video buffers, it is up to the receiver of
2518486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * the video buffers to interpret the contents and to find the actual frame
2528486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * data with the help of the meta data in the buffer. How this is done is
2538486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * outside of the scope of this method.
2548486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
2558486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Some camera HALs may not support storing meta data in the video buffers,
2568486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * but all camera HALs must support storing real YUV data in the video
2578486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * buffers. If the camera HAL does not support storing the meta data in the
2588486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * video buffers when it is requested to do do, INVALID_OPERATION must be
2598486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * returned. It is very useful for the camera HAL to pass meta data rather
2608486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * than the actual frame data directly to the video encoder, since the
2618486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * amount of the uncompressed frame data can be very large if video size is
2628486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * large.
2638486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
2648486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @param enable Set to true to instruct the camera HAL to store meta data
2658486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     in the video buffers; false to instruct the camera HAL to store real
2668486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     YUV data in the video buffers.
2678486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
2688486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status OK on success.
2698486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
2708486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    storeMetaDataInBuffers(bool enable) generates (Status status);
2718486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
2728486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
2738486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Start record mode.
2748486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
2758486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * When a record image is available, a CAMERA_MSG_VIDEO_FRAME message is
2768486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * sent with the corresponding frame. Every record frame must be released by
2778486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * a camera HAL client via releaseRecordingFrame() before the client calls
2788486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * disableMsgType(CAMERA_MSG_VIDEO_FRAME). After the client calls
2798486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's
2808486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * responsibility to manage the life-cycle of the video recording frames,
2818486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * and the client must not modify/access any video recording frames.
2828486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
2838486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status The status code for the operation.
2848486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
2858486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    startRecording() generates (Status status);
2868486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
2878486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
2888486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Stop a previously started recording.
2898486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
2908486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    stopRecording();
2918486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
2928486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
2938486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Returns true if recording is enabled.
2948486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
2958486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return enabled True if recording is currently active.
2968486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
2978486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    recordingEnabled() generates (bool enabled);
2988486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
2998486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
300248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * Release a record frame previously returned by CAMERA_MSG_VIDEO_FRAME in
301248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * dataCallbackTimestamp.
3028486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
3038486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * It is camera HAL client's responsibility to release video recording
3048486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * frames sent out by the camera HAL before the camera HAL receives a call
3058486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * to disableMsgType(CAMERA_MSG_VIDEO_FRAME). After it receives the call to
3068486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's
3078486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * responsibility to manage the life-cycle of the video recording frames.
3088486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
309248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * @param memId The memory buffer to release a recording frame from.
3108486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @param bufferIndex The specific buffer index to return to the HAL.
3118486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
312248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh    releaseRecordingFrame(MemoryId memId, uint32_t bufferIndex);
313248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh
314248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh    /**
315248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * Release a record frame previously returned by CAMERA_MSG_VIDEO_FRAME in
316248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * handleCallbackTimestamp.
317248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     *
318248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * It is camera HAL client's responsibility to release video recording
319248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * frames sent out by the camera HAL before the camera HAL receives a call
320248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * to disableMsgType(CAMERA_MSG_VIDEO_FRAME). After it receives the call to
321248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's
322248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * responsibility to manage the life-cycle of the video recording frames.
323248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     *
324248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * @param memId The memory buffer to release a recording frame from.
325248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * @param bufferIndex The specific buffer index to return to the HAL.
326248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * @param frame The handle for a released video frame
327248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     */
328248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh    releaseRecordingFrameHandle(MemoryId memId, uint32_t bufferIndex, handle frame);
3298486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
3308486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
3311ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh     * Release a batch of record frames previously returned by CAMERA_MSG_VIDEO_FRAME
3321ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh     * in handleCallbackTimestampBatch.
3331ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh     *
3341ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh     * It is camera HAL client's responsibility to release video recording
3351ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh     * frames sent out by the camera HAL before the camera HAL receives a call
3361ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh     * to disableMsgType(CAMERA_MSG_VIDEO_FRAME). After it receives the call to
3371ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh     * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's
3381ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh     * responsibility to manage the life-cycle of the video recording frames.
3391ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh     *
3401ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh     * @param batch A batch of recording frames to be released by camera HAL.
3411ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh     */
3421ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh    releaseRecordingFrameHandleBatch(vec<VideoFrameMessage> batch);
3431ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh
3441ba83a9a282afa086ac2431942a4814633438ffcYin-Chia Yeh    /**
3458486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Start auto focus.
3468486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
3478486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * The notification callback routine is called with
3488486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * CAMERA_MSG_FOCUS once when focusing is complete. autoFocus() can be
3498486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * called again after that if another auto focus is needed.
3508486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
3518486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status The status code for this operation.
3528486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
3538486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    autoFocus() generates (Status status);
3548486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
3558486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
3568486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Cancels auto-focus function.
3578486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
3588486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * If the auto-focus is still in progress, this function must cancel
3598486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * it. Whether the auto-focus is in progress or not, this function must
3608486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * return the focus position to the default. If the camera does not support
3618486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * auto-focus, this is a no-op.
3628486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
3638486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status The status code for this operation.
3648486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
3658486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    cancelAutoFocus() generates (Status status);
3668486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
3678486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
3688486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Take a picture.
3698486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
3708486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status The status code for this operation.
3718486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
3728486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    takePicture() generates (Status status);
3738486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
3748486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
3758486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Cancel a picture that was started with takePicture. Calling this method
3768486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * when no picture is being taken is a no-op.
3778486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
3788486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status The status code for this operation.
3798486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
3808486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    cancelPicture() generates (Status status);
3818486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
3828486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
3838486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Set the camera parameters.
3848486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
385248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh     * @param params The parameter string, consisting of
3868486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *    '<key1>=<value1>; ...;<keyN>=<valueN>'.
3878486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status The status code for this operation:
3888486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     OK: Parameter update was successful
3898486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *     ILLEGAL_ARGUMENT: At least one parameter was invalid or not supported
3908486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
3918486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
392248ed700fed7e682eddf3d0607592eb5f3a3fb1aYin-Chia Yeh    setParameters(string params) generates (Status status);
3938486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
3948486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
3958486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Retrieve the camera parameters.
3968486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
3978486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    getParameters() generates (string parms);
3988486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
3998486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
4008486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Send command to camera driver.
4018486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * The meaning of the arguments is defined by the value of cmd, documented
4028486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * in the CommandType definition.
4038486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
4048486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @param cmd The command to invoke.
4058486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @param arg1 The first argument for the command, if needed.
4068486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @param arg2 The second argument for the command, if needed.
4078486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     *
4088486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * @return status The status code for this operation.
4098486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
4108486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    sendCommand(CommandType cmd, int32_t arg1, int32_t arg2)
4118486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He            generates (Status status);
4128486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
4138486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    /**
4148486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * Release the hardware resources owned by this object, shutting down the
4158486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     * camera device.
4168486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He     */
4178486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He    close();
4188486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He
4198486e4179cc493e3e64a22f830b307f9a5d2b095Zhijun He};
420