Update the signature of init function to include whether the device is am: 3e7b35ee18 am: 43e0dd5936 am: 234cb4857b am: 1d90247bb1
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/12308134
Change-Id: I5fa26d51e29dc79cb08209b5ccea9de73d5f465a
diff --git a/Android.bp b/Android.bp
index 4766b71..ce4214e 100644
--- a/Android.bp
+++ b/Android.bp
@@ -16,7 +16,17 @@
],
export_include_dirs: ["include"],
+ recovery_available: true,
vendor_available: true,
+ target: {
+ recovery: {
+ exclude_header_libs: [
+ "libaudio_system_headers",
+ "libbluetooth-types-header",
+ ],
+ },
+ },
+
}
cc_library_shared {
@@ -38,9 +48,15 @@
header_libs: ["libhardware_headers"],
export_header_lib_headers: ["libhardware_headers"],
+ recovery_available: true,
vendor_available: true,
vndk: {
enabled: true,
support_system_process: true,
},
+ target: {
+ recovery: {
+ exclude_shared_libs: ["libvndksupport"],
+ },
+ },
}
diff --git a/hardware.c b/hardware.c
index 77cfd8d..6e72ce9 100644
--- a/hardware.c
+++ b/hardware.c
@@ -24,12 +24,15 @@
#include <errno.h>
#include <limits.h>
#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
#define LOG_TAG "HAL"
#include <log/log.h>
+#if !defined(__ANDROID_RECOVERY__)
#include <vndksupport/linker.h>
+#endif
/** Base path of the hal modules */
#if defined(__LP64__)
@@ -94,7 +97,11 @@
*/
handle = dlopen(path, RTLD_NOW);
} else {
+#if defined(__ANDROID_RECOVERY__)
+ handle = dlopen(path, RTLD_NOW);
+#else
handle = android_load_sphal_library(path, RTLD_NOW);
+#endif
}
if (handle == NULL) {
char const *err_str = dlerror();
@@ -133,7 +140,7 @@
}
} else {
ALOGV("loaded HAL id=%s path=%s hmi=%p handle=%p",
- id, path, *pHmi, handle);
+ id, path, hmi, handle);
}
*pHmi = hmi;
@@ -142,6 +149,25 @@
}
/*
+ * If path is in in_path.
+ */
+static bool path_in_path(const char *path, const char *in_path) {
+ char real_path[PATH_MAX];
+ if (realpath(path, real_path) == NULL) return false;
+
+ char real_in_path[PATH_MAX];
+ if (realpath(in_path, real_in_path) == NULL) return false;
+
+ const size_t real_in_path_len = strlen(real_in_path);
+ if (strncmp(real_path, real_in_path, real_in_path_len) != 0) {
+ return false;
+ }
+
+ return strlen(real_path) > real_in_path_len &&
+ real_path[real_in_path_len] == '/';
+}
+
+/*
* Check if a HAL with given name and subname exists, if so return 0, otherwise
* otherwise return negative. On success path will contain the path to the HAL.
*/
@@ -150,18 +176,18 @@
{
snprintf(path, path_len, "%s/%s.%s.so",
HAL_LIBRARY_PATH3, name, subname);
- if (access(path, R_OK) == 0)
+ if (path_in_path(path, HAL_LIBRARY_PATH3) && access(path, R_OK) == 0)
return 0;
snprintf(path, path_len, "%s/%s.%s.so",
HAL_LIBRARY_PATH2, name, subname);
- if (access(path, R_OK) == 0)
+ if (path_in_path(path, HAL_LIBRARY_PATH2) && access(path, R_OK) == 0)
return 0;
#ifndef __ANDROID_VNDK__
snprintf(path, path_len, "%s/%s.%s.so",
HAL_LIBRARY_PATH1, name, subname);
- if (access(path, R_OK) == 0)
+ if (path_in_path(path, HAL_LIBRARY_PATH1) && access(path, R_OK) == 0)
return 0;
#endif
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index 10a8789..feebd23 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -550,6 +550,36 @@
size_t *mic_count);
/**
+ * Called by the framework to instruct the HAL to optimize the capture stream in the
+ * specified direction.
+ *
+ * \param[in] stream the stream object.
+ * \param[in] direction The direction constant (from audio-base.h)
+ * MIC_DIRECTION_UNSPECIFIED Don't do any directionality processing of the
+ * activated microphone(s).
+ * MIC_DIRECTION_FRONT Optimize capture for audio coming from the screen-side
+ * of the device.
+ * MIC_DIRECTION_BACK Optimize capture for audio coming from the side of the
+ * device opposite the screen.
+ * MIC_DIRECTION_EXTERNAL Optimize capture for audio coming from an off-device
+ * microphone.
+ * \return OK if the call is successful, an error code otherwise.
+ */
+ int (*set_microphone_direction)(const struct audio_stream_in *stream,
+ audio_microphone_direction_t direction);
+
+ /**
+ * Called by the framework to specify to the HAL the desired zoom factor for the selected
+ * microphone(s).
+ *
+ * \param[in] stream the stream object.
+ * \param[in] zoom the zoom factor.
+ * \return OK if the call is successful, an error code otherwise.
+ */
+ int (*set_microphone_field_dimension)(const struct audio_stream_in *stream,
+ float zoom);
+
+ /**
* Called when the metadata of the stream's sink has been changed.
* @param sink_metadata Description of the audio that is recorded by the clients.
*/
diff --git a/include/hardware/camera3.h b/include/hardware/camera3.h
index c3ea0aa..7fb86df 100644
--- a/include/hardware/camera3.h
+++ b/include/hardware/camera3.h
@@ -21,7 +21,7 @@
#include "camera_common.h"
/**
- * Camera device HAL 3.5[ CAMERA_DEVICE_API_VERSION_3_5 ]
+ * Camera device HAL 3.6[ CAMERA_DEVICE_API_VERSION_3_6 ]
*
* This is the current recommended version of the camera device HAL.
*
@@ -29,7 +29,7 @@
* android.hardware.camera2 API as LIMITED or above hardware level.
*
* Camera devices that support this version of the HAL must return
- * CAMERA_DEVICE_API_VERSION_3_5 in camera_device_t.common.version and in
+ * CAMERA_DEVICE_API_VERSION_3_6 in camera_device_t.common.version and in
* camera_info_t.device_version (from camera_module_t.get_camera_info).
*
* CAMERA_DEVICE_API_VERSION_3_3 and above:
@@ -183,6 +183,25 @@
* for a logical multi camera, the application has the option to specify individual
* settings for a particular physical device.
*
+ * 3.6: Minor revisions to support HAL buffer management APIs:
+ *
+ * - Add ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION static metadata, which allows HAL to
+ * opt in to the new buffer management APIs described below.
+ *
+ * - Add request_stream_buffers() and return_stream_buffers() to camera3_callback_ops_t for HAL to
+ * request and return output buffers from camera service.
+ *
+ * - Add signal_stream_flush() to camera3_device_ops_t for camera service to notify HAL an
+ * upcoming configure_streams() call requires HAL to return buffers of certain streams.
+ *
+ * - Add CAMERA3_JPEG_APP_SEGMENTS_BLOB_ID to support BLOB with only JPEG apps
+ * segments and thumbnail (without main image bitstream). Camera framework
+ * uses such stream togerther with a HAL YUV_420_888/IMPLEMENTATION_DEFINED
+ * stream to encode HEIC (ISO/IEC 23008-12) image.
+ *
+ * - Add is_reconfiguration_required() to camera3_device_ops_t to enable HAL to skip or
+ * trigger stream reconfiguration depending on new session parameter values.
+ *
*/
/**
@@ -1313,7 +1332,7 @@
* To avoid excessive amount of noise reduction and insufficient amount of edge enhancement
* being applied to the input buffer, the application can hint the HAL how much effective
* exposure time improvement has been done by the application, then the HAL can adjust the
- * noise reduction and edge enhancement paramters to get best reprocessed image quality.
+ * noise reduction and edge enhancement parameters to get best reprocessed image quality.
* Below tag can be used for this purpose:
* - android.reprocess.effectiveExposureFactor
* The value would be exposure time increase factor applied to the original output image,
@@ -1941,21 +1960,25 @@
/**
* camera3_jpeg_blob:
*
- * Transport header for compressed JPEG buffers in output streams.
+ * Transport header for compressed JPEG or JPEG_APP_SEGMENTS buffers in output streams.
*
- * To capture JPEG images, a stream is created using the pixel format
+ * To capture JPEG or JPEG_APP_SEGMENTS images, a stream is created using the pixel format
* HAL_PIXEL_FORMAT_BLOB. The buffer size for the stream is calculated by the
- * framework, based on the static metadata field android.jpeg.maxSize. Since
- * compressed JPEG images are of variable size, the HAL needs to include the
- * final size of the compressed image using this structure inside the output
- * stream buffer. The JPEG blob ID field must be set to CAMERA3_JPEG_BLOB_ID.
+ * framework, based on the static metadata field android.jpeg.maxSize for JPEG,
+ * and android.jpeg.maxAppsSegments for JPEG_APP_SEGMENTS.
*
- * Transport header should be at the end of the JPEG output stream buffer. That
+ * Since compressed JPEG/JPEG_APP_SEGMENTS images are of variable size, the HAL needs to
+ * include the final size of the image using this structure inside the output
+ * stream buffer. The JPEG blob ID field must be set to CAMERA3_JPEG_BLOB_ID for
+ * JPEG and CAMERA3_JPEG_APP_SEGMENTS_BLOB_ID for APP segments.
+ *
+ * Transport header should be at the end of the output stream buffer. That
* means the jpeg_blob_id must start at byte[buffer_size -
* sizeof(camera3_jpeg_blob)], where the buffer_size is the size of gralloc buffer.
- * Any HAL using this transport header must account for it in android.jpeg.maxSize
- * The JPEG data itself starts at the beginning of the buffer and should be
- * jpeg_size bytes long.
+ * The blob data itself starts at the beginning of the buffer and should be
+ * jpeg_size bytes long. HAL using this transport header for JPEG must account for
+ * it in android.jpeg.maxSize. For JPEG APP segments, camera framework makes
+ * sure that the output stream buffer is large enough for the transport header.
*/
typedef struct camera3_jpeg_blob {
uint16_t jpeg_blob_id;
@@ -1963,7 +1986,8 @@
} camera3_jpeg_blob_t;
enum {
- CAMERA3_JPEG_BLOB_ID = 0x00FF
+ CAMERA3_JPEG_BLOB_ID = 0x00FF,
+ CAMERA3_JPEG_APP_SEGMENTS_BLOB_ID = 0x0100,
};
/**********************************************************************
@@ -2029,6 +2053,14 @@
* available. Subsequent requests are unaffected, and the device remains
* operational. The frame_number field specifies the request for which
* result metadata won't be available.
+ *
+ * >= CAMERA_DEVICE_API_VERSION_3_6:
+ *
+ * In case the result metadata is absent for a logical camera device, then the
+ * error_stream pointer must be set to NULL.
+ * If the result metadata cannot be produced for a physical camera device, then
+ * error_stream must contain a pointer to a respective stream associated with
+ * that physical device.
*/
CAMERA3_MSG_ERROR_RESULT = 3,
@@ -2126,6 +2158,153 @@
} camera3_notify_msg_t;
+
+/**********************************************************************
+ *
+ * Types definition for request_stream_buffers() callback.
+ *
+ */
+
+/**
+ * camera3_buffer_request_status_t:
+ *
+ * The overall buffer request status returned by request_stream_buffers()
+ */
+typedef enum camera3_buffer_request_status {
+ /**
+ * request_stream_buffers() call succeeded and all requested buffers are
+ * returned.
+ */
+ CAMERA3_BUF_REQ_OK = 0,
+
+ /**
+ * request_stream_buffers() call failed for some streams.
+ * Check per stream status for each returned camera3_stream_buffer_ret_t.
+ */
+ CAMERA3_BUF_REQ_FAILED_PARTIAL = 1,
+
+ /**
+ * request_stream_buffers() call failed for all streams and no buffers are
+ * returned at all. Camera service is about to or is performing
+ * configure_streams() call. HAL must wait until next configure_streams()
+ * call is finished before requesting buffers again.
+ */
+ CAMERA3_BUF_REQ_FAILED_CONFIGURING = 2,
+
+ /**
+ * request_stream_buffers() call failed for all streams and no buffers are
+ * returned at all. Failure due to bad camera3_buffer_request input, eg:
+ * unknown stream or repeated stream in the list of buffer requests.
+ */
+ CAMERA3_BUF_REQ_FAILED_ILLEGAL_ARGUMENTS = 3,
+
+ /**
+ * request_stream_buffers() call failed for all streams and no buffers are
+ * returned at all. This can happen for unknown reasons or a combination
+ * of different failure reasons per stream. For the latter case, caller can
+ * check per stream failure reason returned in camera3_stream_buffer_ret.
+ */
+ CAMERA3_BUF_REQ_FAILED_UNKNOWN = 4,
+
+ /**
+ * Number of buffer request status
+ */
+ CAMERA3_BUF_REQ_NUM_STATUS
+
+} camera3_buffer_request_status_t;
+
+/**
+ * camera3_stream_buffer_req_status_t:
+ *
+ * The per stream buffer request status returned by request_stream_buffers()
+ */
+typedef enum camera3_stream_buffer_req_status {
+ /**
+ * Get buffer succeeds and all requested buffers are returned.
+ */
+ CAMERA3_PS_BUF_REQ_OK = 0,
+
+ /**
+ * Get buffer failed due to timeout waiting for an available buffer. This is
+ * likely due to the client application holding too many buffers, or the
+ * system is under memory pressure.
+ * This is not a fatal error. HAL can try to request buffer for this stream
+ * later. If HAL cannot get a buffer for certain capture request in time
+ * due to this error, HAL can send an ERROR_REQUEST to camera service and
+ * drop processing that request.
+ */
+ CAMERA3_PS_BUF_REQ_NO_BUFFER_AVAILABLE = 1,
+
+ /**
+ * Get buffer failed due to HAL has reached its maxBuffer count. This is not
+ * a fatal error. HAL can try to request buffer for this stream again after
+ * it returns at least one buffer of that stream to camera service.
+ */
+ CAMERA3_PS_BUF_REQ_MAX_BUFFER_EXCEEDED = 2,
+
+ /**
+ * Get buffer failed due to the stream is disconnected by client
+ * application, has been removed, or not recognized by camera service.
+ * This means application is no longer interested in this stream.
+ * Requesting buffer for this stream will never succeed after this error is
+ * returned. HAL must safely return all buffers of this stream after
+ * getting this error. If HAL gets another capture request later targeting
+ * a disconnected stream, HAL must send an ERROR_REQUEST to camera service
+ * and drop processing that request.
+ */
+ CAMERA3_PS_BUF_REQ_STREAM_DISCONNECTED = 3,
+
+ /**
+ * Get buffer failed for unknown reason. This is a fatal error and HAL must
+ * send ERROR_DEVICE to camera service and be ready to be closed.
+ */
+ CAMERA3_PS_BUF_REQ_UNKNOWN_ERROR = 4,
+
+ /**
+ * Number of buffer request status
+ */
+ CAMERA3_PS_BUF_REQ_NUM_STATUS
+} camera3_stream_buffer_req_status_t;
+
+typedef struct camera3_buffer_request {
+ /**
+ * The stream HAL wants to request buffer from
+ */
+ camera3_stream_t *stream;
+
+ /**
+ * The number of buffers HAL requested
+ */
+ uint32_t num_buffers_requested;
+} camera3_buffer_request_t;
+
+typedef struct camera3_stream_buffer_ret {
+ /**
+ * The stream HAL wants to request buffer from
+ */
+ camera3_stream_t *stream;
+
+ /**
+ * The status of buffer request of this stream
+ */
+ camera3_stream_buffer_req_status_t status;
+
+ /**
+ * Number of output buffers returned. Must be 0 when above status is not
+ * CAMERA3_PS_BUF_REQ_OK; otherwise the value must be equal to
+ * num_buffers_requested in the corresponding camera3_buffer_request_t
+ */
+ uint32_t num_output_buffers;
+
+ /**
+ * The returned output buffers for the stream.
+ * Caller of request_stream_buffers() should supply this with enough memory
+ * (num_buffers_requested * sizeof(camera3_stream_buffer_t))
+ */
+ camera3_stream_buffer_t *output_buffers;
+} camera3_stream_buffer_ret_t;
+
+
/**********************************************************************
*
* Capture request/result definitions for the HAL process_capture_request()
@@ -2643,6 +2822,65 @@
void (*notify)(const struct camera3_callback_ops *,
const camera3_notify_msg_t *msg);
+ /**
+ * request_stream_buffers:
+ *
+ * <= CAMERA_DEVICE_API_VERISON_3_5:
+ *
+ * DO NOT USE: not defined and must be NULL.
+ *
+ * >= CAMERA_DEVICE_API_VERISON_3_6:
+ *
+ * Synchronous callback for HAL to ask for output buffer from camera service.
+ *
+ * This call may be serialized in camera service so it is strongly
+ * recommended to only call this method from one thread.
+ *
+ * When camera device advertises
+ * (android.info.supportedBufferManagementVersion ==
+ * ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5), HAL
+ * can use this method to request buffers from camera service.
+ *
+ * Caller is responsible for allocating enough memory for returned_buf_reqs
+ * argument (num_buffer_reqs * sizeof(camera3_stream_buffer_ret_t)) bytes
+ * and also the memory for the output_buffers field in each
+ * camera3_stream_buffer_ret_t
+ * (num_buffers_requested * sizeof(camera3_stream_buffer_t)) bytes
+ *
+ * Performance requirements:
+ * This is a blocking call that takes more time with more buffers requested.
+ * HAL should not request large amount of buffers on a latency critical code
+ * path. It is highly recommended to use a dedicated thread to perform
+ * all requestStreamBuffer calls, and adjust the thread priority and/or
+ * timing of making the call in order for buffers to arrive before HAL is
+ * ready to fill the buffer.
+ */
+ camera3_buffer_request_status_t (*request_stream_buffers)(
+ const struct camera3_callback_ops *,
+ uint32_t num_buffer_reqs,
+ const camera3_buffer_request_t *buffer_reqs,
+ /*out*/uint32_t *num_returned_buf_reqs,
+ /*out*/camera3_stream_buffer_ret_t *returned_buf_reqs);
+
+ /**
+ * return_stream_buffers:
+ *
+ * <= CAMERA_DEVICE_API_VERISON_3_5:
+ *
+ * DO NOT USE: not defined and must be NULL.
+ *
+ * >= CAMERA_DEVICE_API_VERISON_3_6:
+ *
+ * Synchronous callback for HAL to return output buffers to camera service.
+ *
+ * If this method is called during a configure_streams() call, it will be
+ * blocked until camera service finishes the ongoing configure_streams() call.
+ */
+ void (*return_stream_buffers)(
+ const struct camera3_callback_ops *,
+ uint32_t num_buffers,
+ const camera3_stream_buffer_t* const* buffers);
+
} camera3_callback_ops_t;
/**********************************************************************
@@ -3221,8 +3459,82 @@
*/
int (*flush)(const struct camera3_device *);
+ /**
+ * signal_stream_flush:
+ *
+ * <= CAMERA_DEVICE_API_VERISON_3_5:
+ *
+ * Not defined and must be NULL
+ *
+ * >= CAMERA_DEVICE_API_VERISON_3_6:
+ *
+ * Signaling HAL camera service is about to perform configure_streams() call
+ * and HAL must return all buffers of designated streams. HAL must finish
+ * inflight requests normally and return all buffers belonging to the
+ * designated streams through process_capture_result() or
+ * return_stream_buffers() API in a timely manner, or camera service will run
+ * into a fatal error.
+ *
+ * Note that this call serves as an optional hint and camera service may
+ * skip calling this if all buffers are already returned.
+ *
+ */
+ void (*signal_stream_flush)(const struct camera3_device*,
+ uint32_t num_streams,
+ const camera3_stream_t* const* streams);
+
+ /**
+ * is_reconfiguration_required:
+ *
+ * <= CAMERA_DEVICE_API_VERISON_3_5:
+ *
+ * Not defined and must be NULL
+ *
+ * >= CAMERA_DEVICE_API_VERISON_3_6:
+ *
+ * Check whether complete stream reconfiguration is required for possible new session
+ * parameter values.
+ *
+ * This method must be called by the camera framework in case the client changes
+ * the value of any advertised session parameters. Depending on the specific values
+ * the HAL can decide whether a complete stream reconfiguration is required. In case
+ * the HAL returns -ENVAL, the camera framework must skip the internal reconfiguration.
+ * In case Hal returns 0, the framework must reconfigure the streams and pass the
+ * new session parameter values accordingly.
+ * This call may be done by the framework some time before the request with new parameters
+ * is submitted to the HAL, and the request may be cancelled before it ever gets submitted.
+ * Therefore, the HAL must not use this query as an indication to change its behavior in any
+ * way.
+ * ------------------------------------------------------------------------
+ *
+ * Preconditions:
+ *
+ * The framework can call this method at any time after active
+ * session configuration. There must be no impact on the performance of
+ * pending camera requests in any way. In particular there must not be
+ * any glitches or delays during normal camera streaming.
+ *
+ * Performance requirements:
+ * HW and SW camera settings must not be changed and there must not be
+ * a user-visible impact on camera performance.
+ *
+ * @param oldSessionParams The currently applied session parameters.
+ * @param newSessionParams The new session parameters set by client.
+ *
+ * @return Status Status code for the operation, one of:
+ * 0: In case the stream reconfiguration is required
+ *
+ * -EINVAL: In case the stream reconfiguration is not required.
+ *
+ * -ENOSYS: In case the camera device does not support the
+ * reconfiguration query.
+ */
+ int (*is_reconfiguration_required)(const struct camera3_device*,
+ const camera_metadata_t* old_session_params,
+ const camera_metadata_t* new_session_params);
+
/* reserved for future use */
- void *reserved[8];
+ void *reserved[6];
} camera3_device_ops_t;
/**********************************************************************
diff --git a/include/hardware/camera_common.h b/include/hardware/camera_common.h
index edd1ada..16651a9 100644
--- a/include/hardware/camera_common.h
+++ b/include/hardware/camera_common.h
@@ -117,6 +117,22 @@
* 4. Module initialization method. This will be called by the camera service
* right after the HAL module is loaded, to allow for one-time initialization
* of the HAL. It is called before any other module methods are invoked.
+ *
+ *******************************************************************************
+ * Version: 2.5 [CAMERA_MODULE_API_VERSION_2_5]
+ *
+ * This camera module version adds below API changes:
+ *
+ * 1. Support to query characteristics of a non-standalone physical camera, which can
+ * only be accessed as part of a logical camera. It also adds camera stream combination
+ * query.
+ *
+ * 2. Ability to query whether a particular camera stream combination is
+ * supported by the camera device.
+ *
+ * 3. Device state change notification. This module version also supports
+ * notification about the overall device state change, such as
+ * folding/unfolding, or covering/uncovering of shutter.
*/
/**
@@ -133,8 +149,9 @@
#define CAMERA_MODULE_API_VERSION_2_2 HARDWARE_MODULE_API_VERSION(2, 2)
#define CAMERA_MODULE_API_VERSION_2_3 HARDWARE_MODULE_API_VERSION(2, 3)
#define CAMERA_MODULE_API_VERSION_2_4 HARDWARE_MODULE_API_VERSION(2, 4)
+#define CAMERA_MODULE_API_VERSION_2_5 HARDWARE_MODULE_API_VERSION(2, 5)
-#define CAMERA_MODULE_API_VERSION_CURRENT CAMERA_MODULE_API_VERSION_2_4
+#define CAMERA_MODULE_API_VERSION_CURRENT CAMERA_MODULE_API_VERSION_2_5
/**
* All device versions <= HARDWARE_DEVICE_API_VERSION(1, 0xFF) must be treated
@@ -149,6 +166,7 @@
#define CAMERA_DEVICE_API_VERSION_3_3 HARDWARE_DEVICE_API_VERSION(3, 3)
#define CAMERA_DEVICE_API_VERSION_3_4 HARDWARE_DEVICE_API_VERSION(3, 4)
#define CAMERA_DEVICE_API_VERSION_3_5 HARDWARE_DEVICE_API_VERSION(3, 5)
+#define CAMERA_DEVICE_API_VERSION_3_6 HARDWARE_DEVICE_API_VERSION(3, 6)
// Device version 3.5 is current, older HAL camera device versions are not
// recommended for new devices.
@@ -644,6 +662,192 @@
} camera_module_callbacks_t;
+/**
+ * camera_stream_t:
+ *
+ * A handle to a single camera input or output stream. A stream is defined by
+ * the framework by its buffer resolution and format and gralloc usage flags.
+ *
+ * The stream structures are owned by the framework and pointers to a
+ * camera_stream passed into the HAL by is_stream_combination_supported() are
+ * only valid within the scope of the call.
+ *
+ * All camera_stream members are immutable.
+ */
+typedef struct camera_stream {
+ /**
+ * The type of the stream, one of the camera3_stream_type_t values.
+ */
+ int stream_type;
+
+ /**
+ * The width in pixels of the buffers in this stream
+ */
+ uint32_t width;
+
+ /**
+ * The height in pixels of the buffers in this stream
+ */
+ uint32_t height;
+
+ /**
+ * The pixel format for the buffers in this stream. Format is a value from
+ * the HAL_PIXEL_FORMAT_* list in system/core/include/system/graphics.h, or
+ * from device-specific headers.
+ *
+ * If HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED is used, then the platform
+ * gralloc module will select a format based on the usage flags provided by
+ * the camera device and the other endpoint of the stream.
+ *
+ */
+ int format;
+
+ /**
+ * The gralloc usage flags for this stream, as needed by the HAL. The usage
+ * flags are defined in gralloc.h (GRALLOC_USAGE_*), or in device-specific
+ * headers.
+ *
+ * For output streams, these are the HAL's producer usage flags. For input
+ * streams, these are the HAL's consumer usage flags. The usage flags from
+ * the producer and the consumer will be combined together and then passed
+ * to the platform gralloc HAL module for allocating the gralloc buffers for
+ * each stream.
+ *
+ * The usage flag for an output stream may be bitwise
+ * combination of usage flags for multiple consumers, for the purpose of
+ * sharing one camera stream between those consumers. The HAL must fail
+ * the stream combination query call with -EINVAL if the combined flags cannot be
+ * supported due to imcompatible buffer format, dataSpace, or other hardware
+ * limitations.
+ */
+ uint32_t usage;
+
+ /**
+ * A field that describes the contents of the buffer. The format and buffer
+ * dimensions define the memory layout and structure of the stream buffers,
+ * while dataSpace defines the meaning of the data within the buffer.
+ *
+ * For most formats, dataSpace defines the color space of the image data.
+ * In addition, for some formats, dataSpace indicates whether image- or
+ * depth-based data is requested. See system/core/include/system/graphics.h
+ * for details of formats and valid dataSpace values for each format.
+ *
+ * Always set by the camera service. The dataspace values are set
+ * using the V0 dataspace definitions in graphics.h
+ */
+ android_dataspace_t data_space;
+
+ /**
+ * The required output rotation of the stream, one of
+ * the camera3_stream_rotation_t values. This must be inspected by HAL along
+ * with stream width and height. For example, if the rotation is 90 degree
+ * and the stream width and height is 720 and 1280 respectively, camera service
+ * will supply buffers of size 720x1280, and HAL should capture a 1280x720 image
+ * and rotate the image by 90 degree counterclockwise. The rotation field is
+ * no-op when the stream type is input. Camera HAL must ignore the rotation
+ * field for an input stream.
+ *
+ * Always set by camera service. HAL must inspect this field during stream
+ * combination query and return -EINVAL if it cannot perform such rotation.
+ * HAL must always support CAMERA3_STREAM_ROTATION_0, so a
+ * is_stream_combination_supported() call must not fail for unsupported rotation if
+ * rotation field of all streams is CAMERA3_STREAM_ROTATION_0.
+ *
+ */
+ int rotation;
+
+ /**
+ * The physical camera id this stream belongs to.
+ * Always set by camera service. If the camera device is not a logical
+ * multi camera, or if the camera is a logical multi camera but the stream
+ * is not a physical output stream, this field will point to a 0-length
+ * string.
+ *
+ * A logical multi camera is a camera device backed by multiple physical
+ * cameras that are also exposed to the application. And for a logical
+ * multi camera, a physical output stream is an output stream specifically
+ * requested on an underlying physical camera.
+ *
+ * For an input stream, this field is guaranteed to be a 0-length string.
+ */
+ const char* physical_camera_id;
+
+} camera_stream_t;
+
+/**
+ * camera_stream_combination_t:
+ *
+ * A structure of stream definitions, used by is_stream_combination_supported(). This
+ * structure defines all the input & output streams for specific camera use case.
+ */
+typedef struct camera_stream_combination {
+ /**
+ * The total number of streams by the framework. This includes
+ * both input and output streams. The number of streams will be at least 1,
+ * and there will be at least one output-capable stream.
+ */
+ uint32_t num_streams;
+
+ /**
+ * An array of camera streams, defining the input/output
+ * stream combination for the camera HAL device.
+ *
+ * At most one input-capable stream may be defined.
+ *
+ * At least one output-capable stream must be defined.
+ */
+ camera_stream_t *streams;
+
+ /**
+ * The operation mode of streams in this stream combination, one of the value
+ * defined in camera3_stream_configuration_mode_t.
+ *
+ */
+ uint32_t operation_mode;
+
+} camera_stream_combination_t;
+
+/**
+ * device_state_t:
+ *
+ * Possible physical states of the overall device, for use with
+ * notify_device_state_change.
+ */
+typedef enum device_state {
+ /**
+ * The device is in its normal physical configuration. This is the default if the
+ * device does not support multiple different states.
+ */
+ NORMAL = 0,
+
+ /**
+ * Camera device(s) facing backward are covered.
+ */
+ BACK_COVERED = 1 << 0,
+
+ /**
+ * Camera device(s) facing foward are covered.
+ */
+ FRONT_COVERED = 1 << 1,
+
+ /**
+ * The device is folded. If not set, the device is unfolded or does not
+ * support folding.
+ *
+ * The exact point when this status change happens during the folding
+ * operation is device-specific.
+ */
+ FOLDED = 1 << 2,
+
+ /**
+ * First vendor-specific device state. All bits above and including this one
+ * are for vendor state values. Values below this one must only be used
+ * for framework-defined states.
+ */
+ VENDOR_STATE_START = 1LL << 32
+
+} device_state_t;
+
typedef struct camera_module {
/**
* Common methods of the camera module. This *must* be the first member of
@@ -909,8 +1113,104 @@
*/
int (*init)();
+ /**
+ * get_physical_camera_info:
+ *
+ * Return the static metadata for a physical camera as a part of a logical
+ * camera device. This function is only called for those physical camera
+ * ID(s) that are not exposed independently. In other words, camera_id will
+ * be greater or equal to the return value of get_number_of_cameras().
+ *
+ * Return values:
+ *
+ * 0: On a successful operation
+ *
+ * -ENODEV: The information cannot be provided due to an internal
+ * error.
+ *
+ * -EINVAL: The input arguments are invalid, i.e. the id is invalid,
+ * and/or the module is invalid.
+ *
+ * Version information (based on camera_module_t.common.module_api_version):
+ *
+ * CAMERA_MODULE_API_VERSION_1_x/2_0/2_1/2_2/2_3/2_4:
+ * Not provided by HAL module. Framework will not call this function.
+ *
+ * CAMERA_MODULE_API_VERSION_2_5 or higher:
+ * If any of the camera devices accessible through this camera module is
+ * a logical multi-camera, and at least one of the physical cameras isn't
+ * a stand-alone camera device, this function will be called by the camera
+ * framework. Calling this function with invalid physical_camera_id will
+ * get -EINVAL, and NULL static_metadata.
+ */
+ int (*get_physical_camera_info)(int physical_camera_id,
+ camera_metadata_t **static_metadata);
+
+ /**
+ * is_stream_combination_supported:
+ *
+ * Check for device support of specific camera stream combination.
+ *
+ * Return values:
+ *
+ * 0: In case the stream combination is supported.
+ *
+ * -EINVAL: In case the stream combination is not supported.
+ *
+ * -ENOSYS: In case stream combination query is not supported.
+ *
+ * Version information (based on camera_module_t.common.module_api_version):
+ *
+ * CAMERA_MODULE_API_VERSION_1_x/2_0/2_1/2_2/2_3/2_4:
+ * Not provided by HAL module. Framework will not call this function.
+ *
+ * CAMERA_MODULE_API_VERSION_2_5 or higher:
+ * Valid to be called by the framework.
+ */
+ int (*is_stream_combination_supported)(int camera_id,
+ const camera_stream_combination_t *streams);
+
+ /**
+ * notify_device_state_change:
+ *
+ * Notify the camera module that the state of the overall device has
+ * changed in some way that the HAL may want to know about.
+ *
+ * For example, a physical shutter may have been uncovered or covered,
+ * or a camera may have been covered or uncovered by an add-on keyboard
+ * or other accessory.
+ *
+ * The state is a bitfield of potential states, and some physical configurations
+ * could plausibly correspond to multiple different combinations of state bits.
+ * The HAL must ignore any state bits it is not actively using to determine
+ * the appropriate camera configuration.
+ *
+ * For example, on some devices the FOLDED state could mean that
+ * backward-facing cameras are covered by the fold, so FOLDED by itself implies
+ * BACK_COVERED. But other devices may support folding but not cover any cameras
+ * when folded, so for those FOLDED would not imply any of the other flags.
+ * Since these relationships are very device-specific, it is difficult to specify
+ * a comprehensive policy. But as a recommendation, it is suggested that if a flag
+ * necessarily implies other flags are set as well, then those flags should be set.
+ * So even though FOLDED would be enough to infer BACK_COVERED on some devices, the
+ * BACK_COVERED flag should also be set for clarity.
+ *
+ * This method may be invoked by the HAL client at any time. It must not
+ * cause any active camera device sessions to be closed, but may dynamically
+ * change which physical camera a logical multi-camera is using for its
+ * active and future output.
+ *
+ * The method must be invoked by the HAL client at least once before the
+ * client calls ICameraDevice::open on any camera device interfaces listed
+ * by this provider, to establish the initial device state.
+ *
+ * Note that the deviceState is 64-bit bitmask, with system defined states in
+ * lower 32-bit and vendor defined states in upper 32-bit.
+ */
+ void (*notify_device_state_change)(uint64_t deviceState);
+
/* reserved for future use */
- void* reserved[5];
+ void* reserved[2];
} camera_module_t;
__END_DECLS
diff --git a/include/hardware/gnss-base.h b/include/hardware/gnss-base.h
index e56020d..706aa38 100644
--- a/include/hardware/gnss-base.h
+++ b/include/hardware/gnss-base.h
@@ -1,6 +1,6 @@
// This file is autogenerated by hidl-gen. Do not edit manually.
// Source: android.hardware.gnss@1.0
-// Root: android.hardware:hardware/interfaces
+// Location: hardware/interfaces/gnss/1.0/
#ifndef HIDL_GENERATED_ANDROID_HARDWARE_GNSS_V1_0_EXPORTED_CONSTANTS_H_
#define HIDL_GENERATED_ANDROID_HARDWARE_GNSS_V1_0_EXPORTED_CONSTANTS_H_
@@ -10,7 +10,7 @@
#endif
enum {
- GNSS_MAX_SVS_COUNT = 64u, // 64
+ GNSS_MAX_SVS_COUNT = 64u,
};
enum {
@@ -24,14 +24,14 @@
};
enum {
- GPS_LOCATION_HAS_LAT_LONG = 1, // 0x0001
- GPS_LOCATION_HAS_ALTITUDE = 2, // 0x0002
- GPS_LOCATION_HAS_SPEED = 4, // 0x0004
- GPS_LOCATION_HAS_BEARING = 8, // 0x0008
- GPS_LOCATION_HAS_HORIZONTAL_ACCURACY = 16, // 0x0010
- GPS_LOCATION_HAS_VERTICAL_ACCURACY = 32, // 0x0020
- GPS_LOCATION_HAS_SPEED_ACCURACY = 64, // 0x0040
- GPS_LOCATION_HAS_BEARING_ACCURACY = 128, // 0x0080
+ GPS_LOCATION_HAS_LAT_LONG = 1 /* 0x0001 */,
+ GPS_LOCATION_HAS_ALTITUDE = 2 /* 0x0002 */,
+ GPS_LOCATION_HAS_SPEED = 4 /* 0x0004 */,
+ GPS_LOCATION_HAS_BEARING = 8 /* 0x0008 */,
+ GPS_LOCATION_HAS_HORIZONTAL_ACCURACY = 16 /* 0x0010 */,
+ GPS_LOCATION_HAS_VERTICAL_ACCURACY = 32 /* 0x0020 */,
+ GPS_LOCATION_HAS_SPEED_ACCURACY = 64 /* 0x0040 */,
+ GPS_LOCATION_HAS_BEARING_ACCURACY = 128 /* 0x0080 */,
};
enum {
@@ -77,8 +77,8 @@
};
enum {
- AGPS_RIL_REQUEST_SETID_IMSI = 1u, // (1 << 0L)
- AGPS_RIL_REQUEST_SETID_MSISDN = 2u, // (1 << 1L)
+ AGPS_RIL_REQUEST_SETID_IMSI = 1u /* (1 << 0L) */,
+ AGPS_RIL_REQUEST_SETID_MSISDN = 2u /* (1 << 1L) */,
};
enum {
@@ -88,39 +88,39 @@
};
enum {
- GPS_POSITION_RECURRENCE_PERIODIC = 0u, // 0
- GPS_POSITION_RECURRENCE_SINGLE = 1u, // 1
+ GPS_POSITION_RECURRENCE_PERIODIC = 0u,
+ GPS_POSITION_RECURRENCE_SINGLE = 1u,
};
enum {
- GPS_DELETE_EPHEMERIS = 1, // 0x0001
- GPS_DELETE_ALMANAC = 2, // 0x0002
- GPS_DELETE_POSITION = 4, // 0x0004
- GPS_DELETE_TIME = 8, // 0x0008
- GPS_DELETE_IONO = 16, // 0x0010
- GPS_DELETE_UTC = 32, // 0x0020
- GPS_DELETE_HEALTH = 64, // 0x0040
- GPS_DELETE_SVDIR = 128, // 0x0080
- GPS_DELETE_SVSTEER = 256, // 0x0100
- GPS_DELETE_SADATA = 512, // 0x0200
- GPS_DELETE_RTI = 1024, // 0x0400
- GPS_DELETE_CELLDB_INFO = 32768, // 0x8000
- GPS_DELETE_ALL = 65535, // 0xFFFF
+ GPS_DELETE_EPHEMERIS = 1 /* 0x0001 */,
+ GPS_DELETE_ALMANAC = 2 /* 0x0002 */,
+ GPS_DELETE_POSITION = 4 /* 0x0004 */,
+ GPS_DELETE_TIME = 8 /* 0x0008 */,
+ GPS_DELETE_IONO = 16 /* 0x0010 */,
+ GPS_DELETE_UTC = 32 /* 0x0020 */,
+ GPS_DELETE_HEALTH = 64 /* 0x0040 */,
+ GPS_DELETE_SVDIR = 128 /* 0x0080 */,
+ GPS_DELETE_SVSTEER = 256 /* 0x0100 */,
+ GPS_DELETE_SADATA = 512 /* 0x0200 */,
+ GPS_DELETE_RTI = 1024 /* 0x0400 */,
+ GPS_DELETE_CELLDB_INFO = 32768 /* 0x8000 */,
+ GPS_DELETE_ALL = 65535 /* 0xFFFF */,
};
enum {
- FLP_BATCH_WAKEUP_ON_FIFO_FULL = 1, // 0x01
+ FLP_BATCH_WAKEUP_ON_FIFO_FULL = 1 /* 0x01 */,
};
enum {
- GPS_CAPABILITY_SCHEDULING = 1u, // (1 << 0)
- GPS_CAPABILITY_MSB = 2u, // (1 << 1)
- GPS_CAPABILITY_MSA = 4u, // (1 << 2)
- GPS_CAPABILITY_SINGLE_SHOT = 8u, // (1 << 3)
- GPS_CAPABILITY_ON_DEMAND_TIME = 16u, // (1 << 4)
- GPS_CAPABILITY_GEOFENCING = 32u, // (1 << 5)
- GPS_CAPABILITY_MEASUREMENTS = 64u, // (1 << 6)
- GPS_CAPABILITY_NAV_MESSAGES = 128u, // (1 << 7)
+ GPS_CAPABILITY_SCHEDULING = 1u /* (1 << 0) */,
+ GPS_CAPABILITY_MSB = 2u /* (1 << 1) */,
+ GPS_CAPABILITY_MSA = 4u /* (1 << 2) */,
+ GPS_CAPABILITY_SINGLE_SHOT = 8u /* (1 << 3) */,
+ GPS_CAPABILITY_ON_DEMAND_TIME = 16u /* (1 << 4) */,
+ GPS_CAPABILITY_GEOFENCING = 32u /* (1 << 5) */,
+ GPS_CAPABILITY_MEASUREMENTS = 64u /* (1 << 6) */,
+ GPS_CAPABILITY_NAV_MESSAGES = 128u /* (1 << 7) */,
};
enum {
@@ -133,55 +133,55 @@
enum {
GNSS_SV_FLAGS_NONE = 0,
- GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA = 1, // (1 << 0)
- GNSS_SV_FLAGS_HAS_ALMANAC_DATA = 2, // (1 << 1)
- GNSS_SV_FLAGS_USED_IN_FIX = 4, // (1 << 2)
- GNSS_SV_FLAGS_HAS_CARRIER_FREQUENCY = 8, // (1 << 3)
+ GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA = 1 /* (1 << 0) */,
+ GNSS_SV_FLAGS_HAS_ALMANAC_DATA = 2 /* (1 << 1) */,
+ GNSS_SV_FLAGS_USED_IN_FIX = 4 /* (1 << 2) */,
+ GNSS_SV_FLAGS_HAS_CARRIER_FREQUENCY = 8 /* (1 << 3) */,
};
enum {
- GPS_GEOFENCE_ENTERED = 1, // (1 << 0L)
- GPS_GEOFENCE_EXITED = 2, // (1 << 1L)
- GPS_GEOFENCE_UNCERTAIN = 4, // (1 << 2L)
+ GPS_GEOFENCE_ENTERED = 1 /* (1 << 0L) */,
+ GPS_GEOFENCE_EXITED = 2 /* (1 << 1L) */,
+ GPS_GEOFENCE_UNCERTAIN = 4 /* (1 << 2L) */,
};
enum {
- GPS_GEOFENCE_UNAVAILABLE = 1, // (1 << 0L)
- GPS_GEOFENCE_AVAILABLE = 2, // (1 << 1L)
+ GPS_GEOFENCE_UNAVAILABLE = 1 /* (1 << 0L) */,
+ GPS_GEOFENCE_AVAILABLE = 2 /* (1 << 1L) */,
};
enum {
GPS_GEOFENCE_OPERATION_SUCCESS = 0,
- GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES = -100, // (-100)
- GPS_GEOFENCE_ERROR_ID_EXISTS = -101, // (-101)
- GPS_GEOFENCE_ERROR_ID_UNKNOWN = -102, // (-102)
- GPS_GEOFENCE_ERROR_INVALID_TRANSITION = -103, // (-103)
- GPS_GEOFENCE_ERROR_GENERIC = -149, // (-149)
+ GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES = -100 /* (-100) */,
+ GPS_GEOFENCE_ERROR_ID_EXISTS = -101 /* (-101) */,
+ GPS_GEOFENCE_ERROR_ID_UNKNOWN = -102 /* (-102) */,
+ GPS_GEOFENCE_ERROR_INVALID_TRANSITION = -103 /* (-103) */,
+ GPS_GEOFENCE_ERROR_GENERIC = -149 /* (-149) */,
};
enum {
GPS_MEASUREMENT_SUCCESS = 0,
- GPS_MEASUREMENT_ERROR_ALREADY_INIT = -100, // (-100)
- GPS_MEASUREMENT_ERROR_GENERIC = -101, // (-101)
+ GPS_MEASUREMENT_ERROR_ALREADY_INIT = -100 /* (-100) */,
+ GPS_MEASUREMENT_ERROR_GENERIC = -101 /* (-101) */,
};
enum {
- GNSS_CLOCK_HAS_LEAP_SECOND = 1, // (1 << 0)
- GNSS_CLOCK_HAS_TIME_UNCERTAINTY = 2, // (1 << 1)
- GNSS_CLOCK_HAS_FULL_BIAS = 4, // (1 << 2)
- GNSS_CLOCK_HAS_BIAS = 8, // (1 << 3)
- GNSS_CLOCK_HAS_BIAS_UNCERTAINTY = 16, // (1 << 4)
- GNSS_CLOCK_HAS_DRIFT = 32, // (1 << 5)
- GNSS_CLOCK_HAS_DRIFT_UNCERTAINTY = 64, // (1 << 6)
+ GNSS_CLOCK_HAS_LEAP_SECOND = 1 /* (1 << 0) */,
+ GNSS_CLOCK_HAS_TIME_UNCERTAINTY = 2 /* (1 << 1) */,
+ GNSS_CLOCK_HAS_FULL_BIAS = 4 /* (1 << 2) */,
+ GNSS_CLOCK_HAS_BIAS = 8 /* (1 << 3) */,
+ GNSS_CLOCK_HAS_BIAS_UNCERTAINTY = 16 /* (1 << 4) */,
+ GNSS_CLOCK_HAS_DRIFT = 32 /* (1 << 5) */,
+ GNSS_CLOCK_HAS_DRIFT_UNCERTAINTY = 64 /* (1 << 6) */,
};
enum {
- GNSS_MEASUREMENT_HAS_SNR = 1u, // (1 << 0)
- GNSS_MEASUREMENT_HAS_CARRIER_FREQUENCY = 512u, // (1 << 9)
- GNSS_MEASUREMENT_HAS_CARRIER_CYCLES = 1024u, // (1 << 10)
- GNSS_MEASUREMENT_HAS_CARRIER_PHASE = 2048u, // (1 << 11)
- GNSS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY = 4096u, // (1 << 12)
- GNSS_MEASUREMENT_HAS_AUTOMATIC_GAIN_CONTROL = 8192u, // (1 << 13)
+ GNSS_MEASUREMENT_HAS_SNR = 1u /* (1 << 0) */,
+ GNSS_MEASUREMENT_HAS_CARRIER_FREQUENCY = 512u /* (1 << 9) */,
+ GNSS_MEASUREMENT_HAS_CARRIER_CYCLES = 1024u /* (1 << 10) */,
+ GNSS_MEASUREMENT_HAS_CARRIER_PHASE = 2048u /* (1 << 11) */,
+ GNSS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY = 4096u /* (1 << 12) */,
+ GNSS_MEASUREMENT_HAS_AUTOMATIC_GAIN_CONTROL = 8192u /* (1 << 13) */,
};
enum {
@@ -191,54 +191,54 @@
};
enum {
- GNSS_MEASUREMENT_STATE_UNKNOWN = 0u, // 0
- GNSS_MEASUREMENT_STATE_CODE_LOCK = 1u, // (1 << 0)
- GNSS_MEASUREMENT_STATE_BIT_SYNC = 2u, // (1 << 1)
- GNSS_MEASUREMENT_STATE_SUBFRAME_SYNC = 4u, // (1 << 2)
- GNSS_MEASUREMENT_STATE_TOW_DECODED = 8u, // (1 << 3)
- GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS = 16u, // (1 << 4)
- GNSS_MEASUREMENT_STATE_SYMBOL_SYNC = 32u, // (1 << 5)
- GNSS_MEASUREMENT_STATE_GLO_STRING_SYNC = 64u, // (1 << 6)
- GNSS_MEASUREMENT_STATE_GLO_TOD_DECODED = 128u, // (1 << 7)
- GNSS_MEASUREMENT_STATE_BDS_D2_BIT_SYNC = 256u, // (1 << 8)
- GNSS_MEASUREMENT_STATE_BDS_D2_SUBFRAME_SYNC = 512u, // (1 << 9)
- GNSS_MEASUREMENT_STATE_GAL_E1BC_CODE_LOCK = 1024u, // (1 << 10)
- GNSS_MEASUREMENT_STATE_GAL_E1C_2ND_CODE_LOCK = 2048u, // (1 << 11)
- GNSS_MEASUREMENT_STATE_GAL_E1B_PAGE_SYNC = 4096u, // (1 << 12)
- GNSS_MEASUREMENT_STATE_SBAS_SYNC = 8192u, // (1 << 13)
- GNSS_MEASUREMENT_STATE_TOW_KNOWN = 16384u, // (1 << 14)
- GNSS_MEASUREMENT_STATE_GLO_TOD_KNOWN = 32768u, // (1 << 15)
+ GNSS_MEASUREMENT_STATE_UNKNOWN = 0u,
+ GNSS_MEASUREMENT_STATE_CODE_LOCK = 1u /* (1 << 0) */,
+ GNSS_MEASUREMENT_STATE_BIT_SYNC = 2u /* (1 << 1) */,
+ GNSS_MEASUREMENT_STATE_SUBFRAME_SYNC = 4u /* (1 << 2) */,
+ GNSS_MEASUREMENT_STATE_TOW_DECODED = 8u /* (1 << 3) */,
+ GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS = 16u /* (1 << 4) */,
+ GNSS_MEASUREMENT_STATE_SYMBOL_SYNC = 32u /* (1 << 5) */,
+ GNSS_MEASUREMENT_STATE_GLO_STRING_SYNC = 64u /* (1 << 6) */,
+ GNSS_MEASUREMENT_STATE_GLO_TOD_DECODED = 128u /* (1 << 7) */,
+ GNSS_MEASUREMENT_STATE_BDS_D2_BIT_SYNC = 256u /* (1 << 8) */,
+ GNSS_MEASUREMENT_STATE_BDS_D2_SUBFRAME_SYNC = 512u /* (1 << 9) */,
+ GNSS_MEASUREMENT_STATE_GAL_E1BC_CODE_LOCK = 1024u /* (1 << 10) */,
+ GNSS_MEASUREMENT_STATE_GAL_E1C_2ND_CODE_LOCK = 2048u /* (1 << 11) */,
+ GNSS_MEASUREMENT_STATE_GAL_E1B_PAGE_SYNC = 4096u /* (1 << 12) */,
+ GNSS_MEASUREMENT_STATE_SBAS_SYNC = 8192u /* (1 << 13) */,
+ GNSS_MEASUREMENT_STATE_TOW_KNOWN = 16384u /* (1 << 14) */,
+ GNSS_MEASUREMENT_STATE_GLO_TOD_KNOWN = 32768u /* (1 << 15) */,
};
enum {
GNSS_ADR_STATE_UNKNOWN = 0,
- GNSS_ADR_STATE_VALID = 1, // (1 << 0)
- GNSS_ADR_STATE_RESET = 2, // (1 << 1)
- GNSS_ADR_STATE_CYCLE_SLIP = 4, // (1 << 2)
+ GNSS_ADR_STATE_VALID = 1 /* (1 << 0) */,
+ GNSS_ADR_STATE_RESET = 2 /* (1 << 1) */,
+ GNSS_ADR_STATE_CYCLE_SLIP = 4 /* (1 << 2) */,
};
enum {
GPS_NAVIGATION_MESSAGE_SUCCESS = 0,
- GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT = -100, // (-100)
- GPS_NAVIGATION_MESSAGE_ERROR_GENERIC = -101, // (-101)
+ GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT = -100 /* (-100) */,
+ GPS_NAVIGATION_MESSAGE_ERROR_GENERIC = -101 /* (-101) */,
};
enum {
GNSS_NAVIGATION_MESSAGE_TYPE_UNKNOWN = 0,
- GNSS_NAVIGATION_MESSAGE_TYPE_GNSS_L1CA = 257, // 0x0101
- GNSS_NAVIGATION_MESSAGE_TYPE_GNSS_L2CNAV = 258, // 0x0102
- GNSS_NAVIGATION_MESSAGE_TYPE_GNSS_L5CNAV = 259, // 0x0103
- GNSS_NAVIGATION_MESSAGE_TYPE_GNSS_CNAV2 = 260, // 0x0104
- GNSS_NAVIGATION_MESSAGE_TYPE_GLO_L1CA = 769, // 0x0301
- GNSS_NAVIGATION_MESSAGE_TYPE_BDS_D1 = 1281, // 0x0501
- GNSS_NAVIGATION_MESSAGE_TYPE_BDS_D2 = 1282, // 0x0502
- GNSS_NAVIGATION_MESSAGE_TYPE_GAL_I = 1537, // 0x0601
- GNSS_NAVIGATION_MESSAGE_TYPE_GAL_F = 1538, // 0x0602
+ GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L1CA = 257 /* 0x0101 */,
+ GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L2CNAV = 258 /* 0x0102 */,
+ GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L5CNAV = 259 /* 0x0103 */,
+ GNSS_NAVIGATION_MESSAGE_TYPE_GPS_CNAV2 = 260 /* 0x0104 */,
+ GNSS_NAVIGATION_MESSAGE_TYPE_GLO_L1CA = 769 /* 0x0301 */,
+ GNSS_NAVIGATION_MESSAGE_TYPE_BDS_D1 = 1281 /* 0x0501 */,
+ GNSS_NAVIGATION_MESSAGE_TYPE_BDS_D2 = 1282 /* 0x0502 */,
+ GNSS_NAVIGATION_MESSAGE_TYPE_GAL_I = 1537 /* 0x0601 */,
+ GNSS_NAVIGATION_MESSAGE_TYPE_GAL_F = 1538 /* 0x0602 */,
};
typedef enum {
- NAV_MESSAGE_STATUS_PARITY_PASSED = 1, // (1 << 0)
- NAV_MESSAGE_STATUS_PARITY_REBUILT = 2, // (1 << 1)
+ NAV_MESSAGE_STATUS_PARITY_PASSED = 1 /* (1 << 0) */,
+ NAV_MESSAGE_STATUS_PARITY_REBUILT = 2 /* (1 << 1) */,
NAV_MESSAGE_STATUS_UNKNOWN = 0,
} navigation_message_status;
@@ -246,12 +246,13 @@
GPS_NI_TYPE_VOICE = 1,
GPS_NI_TYPE_UMTS_SUPL = 2,
GPS_NI_TYPE_UMTS_CTRL_PLANE = 3,
+ GPS_NI_TYPE_EMERGENCY_SUPL = 4,
};
enum {
- GPS_NI_NEED_NOTIFY = 1u, // 0x0001
- GPS_NI_NEED_VERIFY = 2u, // 0x0002
- GPS_NI_PRIVACY_OVERRIDE = 4u, // 0x0004
+ GPS_NI_NEED_NOTIFY = 1u /* 0x0001 */,
+ GPS_NI_NEED_VERIFY = 2u /* 0x0002 */,
+ GPS_NI_PRIVACY_OVERRIDE = 4u /* 0x0004 */,
};
enum {
@@ -265,7 +266,7 @@
GPS_ENC_SUPL_GSM_DEFAULT = 1,
GPS_ENC_SUPL_UTF8 = 2,
GPS_ENC_SUPL_UCS2 = 3,
- GPS_ENC_UNKNOWN = -1, // (-1)
+ GPS_ENC_UNKNOWN = -1 /* (-1) */,
};
#ifdef __cplusplus
diff --git a/include/hardware/gralloc.h b/include/hardware/gralloc.h
index 5dafea0..10a153c 100644
--- a/include/hardware/gralloc.h
+++ b/include/hardware/gralloc.h
@@ -131,6 +131,9 @@
* handle this flag. */
GRALLOC_USAGE_FOREIGN_BUFFERS = 0x00200000U,
+ /* buffer will be used as input to HW HEIC image encoder */
+ GRALLOC_USAGE_HW_IMAGE_ENCODER = 0x08000000U,
+
/* Mask of all flags which could be passed to a gralloc module for buffer
* allocation. Any flags not in this mask do not need to be handled by
* gralloc modules. */
@@ -311,8 +314,38 @@
int l, int t, int w, int h,
struct android_ycbcr *ycbcr, int fenceFd);
+ /* getTransportSize(..., outNumFds, outNumInts)
+ * This function is mandatory on devices running IMapper2.1 or higher.
+ *
+ * Get the transport size of a buffer. An imported buffer handle is a raw
+ * buffer handle with the process-local runtime data appended. This
+ * function, for example, allows a caller to omit the process-local
+ * runtime data at the tail when serializing the imported buffer handle.
+ *
+ * Note that a client might or might not omit the process-local runtime
+ * data when sending an imported buffer handle. The mapper must support
+ * both cases on the receiving end.
+ */
+ int32_t (*getTransportSize)(
+ struct gralloc_module_t const* module, buffer_handle_t handle, uint32_t *outNumFds,
+ uint32_t *outNumInts);
+
+ /* validateBufferSize(..., w, h, format, usage, stride)
+ * This function is mandatory on devices running IMapper2.1 or higher.
+ *
+ * Validate that the buffer can be safely accessed by a caller who assumes
+ * the specified width, height, format, usage, and stride. This must at least validate
+ * that the buffer size is large enough. Validating the buffer against
+ * individual buffer attributes is optional.
+ */
+ int32_t (*validateBufferSize)(
+ struct gralloc_module_t const* device, buffer_handle_t handle,
+ uint32_t w, uint32_t h, int32_t format, int usage,
+ uint32_t stride);
+
/* reserved for future use */
- void* reserved_proc[3];
+ void* reserved_proc[1];
+
} gralloc_module_t;
/*****************************************************************************/
diff --git a/include/hardware/gralloc1.h b/include/hardware/gralloc1.h
index 03e8432..c211029 100644
--- a/include/hardware/gralloc1.h
+++ b/include/hardware/gralloc1.h
@@ -675,7 +675,6 @@
/* getTransportSize(..., outNumFds, outNumInts)
* Function descriptor: GRALLOC1_FUNCTION_GET_TRANSPORT_SIZE
- * This function is optional for all gralloc1 devices.
*
* Get the transport size of a buffer. An imported buffer handle is a raw
* buffer handle with the process-local runtime data appended. This
@@ -710,7 +709,6 @@
/* validateBufferSize(..., )
* Function descriptor: GRALLOC1_FUNCTION_VALIDATE_BUFFER_SIZE
- * This function is optional for all gralloc1 devices.
*
* Validate that the buffer can be safely accessed by a caller who assumes
* the specified descriptorInfo and stride. This must at least validate
diff --git a/include/hardware/hwcomposer2.h b/include/hardware/hwcomposer2.h
index c9809ce..c70aef6 100644
--- a/include/hardware/hwcomposer2.h
+++ b/include/hardware/hwcomposer2.h
@@ -270,7 +270,18 @@
HWC2_FUNCTION_GET_READBACK_BUFFER_FENCE,
HWC2_FUNCTION_GET_RENDER_INTENTS,
HWC2_FUNCTION_SET_COLOR_MODE_WITH_RENDER_INTENT,
- HWC2_FUNCTION_GET_DATASPACE_SATURATION_MATRIX
+ HWC2_FUNCTION_GET_DATASPACE_SATURATION_MATRIX,
+
+ // composer 2.3
+ HWC2_FUNCTION_GET_DISPLAY_IDENTIFICATION_DATA,
+ HWC2_FUNCTION_GET_DISPLAY_CAPABILITIES,
+ HWC2_FUNCTION_SET_LAYER_COLOR_TRANSFORM,
+ HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES,
+ HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED,
+ HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLE,
+ HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS,
+ HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT,
+ HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS,
} hwc2_function_descriptor_t;
/* Layer requests returned from getDisplayRequests */
@@ -347,6 +358,62 @@
HWC2_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11,
} hwc2_per_frame_metadata_key_t;
+/* SetDisplayedContentSampling values passed to setDisplayedContentSamplingEnabled */
+typedef enum {
+ HWC2_DISPLAYED_CONTENT_SAMPLING_INVALID = 0,
+
+ /* Enable displayed content sampling */
+ HWC2_DISPLAYED_CONTENT_SAMPLING_ENABLE = 1,
+
+ /* Disable displayed content sampling */
+ HWC2_DISPLAYED_CONTENT_SAMPLING_DISABLE = 2,
+} hwc2_displayed_content_sampling_t;
+
+typedef enum {
+ HWC2_FORMAT_COMPONENT_0 = 1 << 0, /* The first component (eg, for RGBA_8888, this is R) */
+ HWC2_FORMAT_COMPONENT_1 = 1 << 1, /* The second component (eg, for RGBA_8888, this is G) */
+ HWC2_FORMAT_COMPONENT_2 = 1 << 2, /* The third component (eg, for RGBA_8888, this is B) */
+ HWC2_FORMAT_COMPONENT_3 = 1 << 3, /* The fourth component (eg, for RGBA_8888, this is A) */
+} hwc2_format_color_component_t;
+
+/* Optional display capabilities which may be supported by some displays.
+ * The particular set of supported capabilities for a given display may be
+ * retrieved using getDisplayCapabilities. */
+typedef enum {
+ HWC2_DISPLAY_CAPABILITY_INVALID = 0,
+
+ /**
+ * Specifies that the display must apply a color transform even when either
+ * the client or the device has chosen that all layers should be composed by
+ * the client. This prevents the client from applying the color transform
+ * during its composition step.
+ * If getDisplayCapabilities is supported, the global capability
+ * HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM is ignored.
+ * If getDisplayCapabilities is not supported, and the global capability
+ * HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM is returned by getCapabilities,
+ * then all displays must be treated as having
+ * HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM.
+ */
+ HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM = 1,
+
+ /**
+ * Specifies that the display supports PowerMode::DOZE and
+ * PowerMode::DOZE_SUSPEND. DOZE_SUSPEND may not provide any benefit
+ * over DOZE (see the definition of PowerMode for more information),
+ * but if both DOZE and DOZE_SUSPEND are no different from
+ * PowerMode::ON, the device must not claim support.
+ * HWC2_DISPLAY_CAPABILITY_DOZE must be returned by getDisplayCapabilities
+ * when getDozeSupport indicates the display supports PowerMode::DOZE and
+ * PowerMode::DOZE_SUSPEND.
+ */
+ HWC2_DISPLAY_CAPABILITY_DOZE = 2,
+
+ /**
+ * Specified that the display supports brightness operations.
+ */
+ HWC2_DISPLAY_CAPABILITY_BRIGHTNESS = 3,
+} hwc2_display_capability_t;
+
/*
* Stringification Functions
*/
@@ -524,6 +591,17 @@
case HWC2_FUNCTION_GET_RENDER_INTENTS: return "GetRenderIntents";
case HWC2_FUNCTION_SET_COLOR_MODE_WITH_RENDER_INTENT: return "SetColorModeWithRenderIntent";
case HWC2_FUNCTION_GET_DATASPACE_SATURATION_MATRIX: return "GetDataspaceSaturationMatrix";
+
+ // composer 2.3
+ case HWC2_FUNCTION_GET_DISPLAY_IDENTIFICATION_DATA: return "GetDisplayIdentificationData";
+ case HWC2_FUNCTION_GET_DISPLAY_CAPABILITIES: return "GetDisplayCapabilities";
+ case HWC2_FUNCTION_SET_LAYER_COLOR_TRANSFORM: return "SetLayerColorTransform";
+ case HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES: return "GetDisplayedContentSamplingAttributes";
+ case HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED: return "SetDisplayedContentSamplingEnabled";
+ case HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLE: return "GetDisplayedContentSample";
+ case HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS: return "SetLayerPerFrameMetadataBlobs";
+ case HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT: return "GetDisplayBrightnessSupport";
+ case HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS: return "SetDisplayBrightness";
default: return "Unknown";
}
}
@@ -569,6 +647,40 @@
}
}
+static inline const char* getDisplayedContentSamplingName(
+ hwc2_displayed_content_sampling_t sampling) {
+ switch (sampling) {
+ case HWC2_DISPLAYED_CONTENT_SAMPLING_INVALID: return "Invalid";
+ case HWC2_DISPLAYED_CONTENT_SAMPLING_ENABLE: return "Enable";
+ case HWC2_DISPLAYED_CONTENT_SAMPLING_DISABLE: return "Disable";
+ default: return "Unknown";
+ }
+}
+
+static inline const char* getFormatColorComponentName(hwc2_format_color_component_t component) {
+ switch (component) {
+ case HWC2_FORMAT_COMPONENT_0: return "FirstComponent";
+ case HWC2_FORMAT_COMPONENT_1: return "SecondComponent";
+ case HWC2_FORMAT_COMPONENT_2: return "ThirdComponent";
+ case HWC2_FORMAT_COMPONENT_3: return "FourthComponent";
+ default: return "Unknown";
+ }
+}
+
+static inline const char* getDisplayCapabilityName(hwc2_display_capability_t capability) {
+ switch (capability) {
+ case HWC2_DISPLAY_CAPABILITY_INVALID: return "Invalid";
+ case HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM:
+ return "SkipClientColorTransform";
+ case HWC2_DISPLAY_CAPABILITY_DOZE:
+ return "Doze";
+ case HWC2_DISPLAY_CAPABILITY_BRIGHTNESS:
+ return "Brightness";
+ default:
+ return "Unknown";
+ }
+}
+
#define TO_STRING(E, T, printer) \
inline std::string to_string(E value) { return printer(value); } \
inline std::string to_string(T value) { return to_string(static_cast<E>(value)); }
@@ -722,6 +834,17 @@
GetRenderIntents = HWC2_FUNCTION_GET_RENDER_INTENTS,
SetColorModeWithRenderIntent = HWC2_FUNCTION_SET_COLOR_MODE_WITH_RENDER_INTENT,
GetDataspaceSaturationMatrix = HWC2_FUNCTION_GET_DATASPACE_SATURATION_MATRIX,
+
+ // composer 2.3
+ GetDisplayIdentificationData = HWC2_FUNCTION_GET_DISPLAY_IDENTIFICATION_DATA,
+ GetDisplayCapabilities = HWC2_FUNCTION_GET_DISPLAY_CAPABILITIES,
+ SetLayerColorTransform = HWC2_FUNCTION_SET_LAYER_COLOR_TRANSFORM,
+ GetDisplayedContentSamplingAttributes = HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES,
+ SetDisplayedContentSamplingEnabled = HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED,
+ GetDisplayedContentSample = HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLE,
+ SetLayerPerFrameMetadataBlobs = HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS,
+ GetDisplayBrightnessSupport = HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT,
+ SetDisplayBrightness = HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS,
};
TO_STRING(hwc2_function_descriptor_t, FunctionDescriptor,
getFunctionDescriptorName)
@@ -758,6 +881,14 @@
};
TO_STRING(hwc2_vsync_t, Vsync, getVsyncName)
+enum class DisplayCapability : int32_t {
+ Invalid = HWC2_DISPLAY_CAPABILITY_INVALID,
+ SkipClientColorTransform = HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM,
+ Doze = HWC2_DISPLAY_CAPABILITY_DOZE,
+ Brightness = HWC2_DISPLAY_CAPABILITY_BRIGHTNESS,
+};
+TO_STRING(hwc2_display_capability_t, DisplayCapability, getDisplayCapabilityName)
+
} // namespace HWC2
__BEGIN_DECLS
@@ -1374,6 +1505,35 @@
hwc2_device_t* device, hwc2_display_t display,
int32_t* /*hwc2_display_type_t*/ outType);
+/* getDisplayIdentificationData(..., outPort, outDataSize, outData)
+ * Descriptor: HWC2_FUNCTION_GET_DISPLAY_IDENTIFICATION_DATA
+ * Optional for HWC2 devices
+ *
+ * If supported, getDisplayIdentificationData returns the port and data that
+ * describe a physical display. The port is a unique number that identifies a
+ * physical connector (e.g. eDP, HDMI) for display output. The data blob is
+ * parsed to determine its format, typically EDID 1.3 as specified in VESA
+ * E-EDID Standard Release A Revision 1.
+ *
+ * Devices for which display identification is unsupported must return null when
+ * getFunction is called with HWC2_FUNCTION_GET_DISPLAY_IDENTIFICATION_DATA.
+ *
+ * Parameters:
+ * outPort - the connector to which the display is connected;
+ * pointer will be non-NULL
+ * outDataSize - if outData is NULL, the size in bytes of the data which would
+ * have been returned; if outData is not NULL, the size of outData, which
+ * must not exceed the value stored in outDataSize prior to the call;
+ * pointer will be non-NULL
+ * outData - the EDID 1.3 blob identifying the display
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_IDENTIFICATION_DATA)(
+ hwc2_device_t* device, hwc2_display_t display, uint8_t* outPort,
+ uint32_t* outDataSize, uint8_t* outData);
+
/* getDozeSupport(..., outSupport)
* Descriptor: HWC2_FUNCTION_GET_DOZE_SUPPORT
* Must be provided by all HWC2 devices
@@ -2073,6 +2233,42 @@
uint32_t numElements, const int32_t* /*hw2_per_frame_metadata_key_t*/ keys,
const float* metadata);
+/* setLayerPerFrameMetadataBlobs(...,numElements, keys, sizes, blobs)
+ * Descriptor: HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS
+ * Optional for HWC2 devices
+ *
+ * If supported, (getFunction(HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS)
+ * is non-null), sets the metadata for the given display and layer.
+ *
+ * Upon returning from this function, the metadata change must have fully taken
+ * effect.
+ *
+ * This function must only be called if getPerFrameMetadataKeys is non-NULL
+ * and returns at least one key that corresponds to a blob type.
+ *
+ * Current valid blob type keys are: HDR10_PLUS_SEI
+ *
+ * Parameters:
+ * numElements is the number of elements in each of the keys, sizes, and
+ * metadata arrays
+ * keys is a pointer to an array of keys. Current valid keys are those listed
+ * above as valid blob type keys.
+ * sizes is a pointer to an array of unsigned ints specifying the sizes of
+ * each metadata blob
+ * metadata is a pointer to a blob of data holding all blobs contiguously in
+ * memory
+ *
+ * Returns HWC2_ERROR_NONE or one of the following erros:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
+ * HWC2_ERROR_BAD_PARAMETER - sizes of keys and metadata parameters does
+ * not match numElements, numElements < 0, or keys contains a
+ * non-valid key (see above for current valid blob type keys).
+ * HWC2_ERROR_UNSUPPORTED - metadata is not supported on this display
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_PER_FRAME_METADATA_BLOBS)(
+ hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer,
+ uint32_t numElements, const int32_t* keys, const uint32_t* sizes,
+ const uint8_t* metadata);
/*
* Layer State Functions
*
@@ -2326,6 +2522,211 @@
hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer,
uint32_t z);
+/* setLayerColorTransform(..., matrix)
+ * Descriptor: HWC2_FUNCTION_SET_LAYER_COLOR_TRANSFORM
+ * Optional by all HWC2 devices
+ *
+ * Sets a matrix for color transform which will be applied on this layer
+ * before composition.
+ *
+ * If the device is not capable of apply the matrix on this layer, it must force
+ * this layer to client composition during VALIDATE_DISPLAY.
+ *
+ * The matrix provided is an affine color transformation of the following form:
+ *
+ * |r.r r.g r.b 0|
+ * |g.r g.g g.b 0|
+ * |b.r b.g b.b 0|
+ * |Tr Tg Tb 1|
+ *
+ * This matrix must be provided in row-major form:
+ *
+ * {r.r, r.g, r.b, 0, g.r, ...}.
+ *
+ * Given a matrix of this form and an input color [R_in, G_in, B_in],
+ * the input color must first be converted to linear space
+ * [R_linear, G_linear, B_linear], then the output linear color
+ * [R_out_linear, G_out_linear, B_out_linear] will be:
+ *
+ * R_out_linear = R_linear * r.r + G_linear * g.r + B_linear * b.r + Tr
+ * G_out_linear = R_linear * r.g + G_linear * g.g + B_linear * b.g + Tg
+ * B_out_linear = R_linear * r.b + G_linear * g.b + B_linear * b.b + Tb
+ *
+ * [R_out_linear, G_out_linear, B_out_linear] must then be converted to
+ * gamma space: [R_out, G_out, B_out] before blending.
+ *
+ * Parameters:
+ * matrix - a 4x4 transform matrix (16 floats) as described above
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
+ * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_COLOR_TRANSFORM)(
+ hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer,
+ const float* matrix);
+
+/* getDisplayedContentSamplingAttributes(...,
+ * format, dataspace, supported_components, max_frames)
+ * Descriptor: HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES
+ * Optional by all HWC2 devices
+ *
+ * Query for what types of color sampling the hardware supports.
+ *
+ * Parameters:
+ * format - The format of the sampled pixels; pointer will be non-NULL
+ * dataspace - The dataspace of the sampled pixels; pointer will be non-NULL
+ * supported_components - The mask of which components can be sampled; pointer
+ * will be non-NULL
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY when an invalid display was passed in, or
+ * HWC2_ERROR_UNSUPPORTED when there is no efficient way to sample.
+ */
+typedef int32_t (*HWC2_PFN_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES)(
+ hwc2_device_t* device, hwc2_display_t display,
+ int32_t* /* android_pixel_format_t */ format,
+ int32_t* /* android_dataspace_t */ dataspace,
+ uint8_t* /* mask of android_component_t */ supported_components);
+
+/* setDisplayedContentSamplingEnabled(..., enabled)
+ * Descriptor: HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED
+ * Optional by all HWC2 devices
+ *
+ * Enables or disables the collection of color content statistics
+ * on this display.
+ *
+ * Sampling occurs on the contents of the final composition on this display
+ * (i.e., the contents presented on screen).
+ *
+ * Sampling support is optional, and is set to DISABLE by default.
+ * On each call to ENABLE, all collected statistics will be reset.
+ *
+ * Sample data can be queried via getDisplayedContentSample().
+ *
+ * Parameters:
+ * enabled - indicates whether to enable or disable sampling.
+ * component_mask - The mask of which components should be sampled.
+ * If zero, all supported components are to be enabled.
+ * max_frames - is the maximum number of frames that should be stored before
+ * discard. The sample represents the most-recently posted frames.
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY when an invalid display handle was passed in,
+ * HWC2_ERROR_BAD_PARAMETER when enabled was an invalid value, or
+ * HWC2_ERROR_NO_RESOURCES when the requested ringbuffer size via max_frames
+ * was not available.
+ * HWC2_ERROR_UNSUPPORTED when there is no efficient way to sample.
+ */
+typedef int32_t (*HWC2_PFN_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED)(
+ hwc2_device_t* device, hwc2_display_t display,
+ int32_t /*hwc2_displayed_content_sampling_t*/ enabled,
+ uint8_t /* mask of android_component_t */ component_mask,
+ uint64_t max_frames);
+
+/* getDisplayedContentSample(..., component, max_frames, timestamp,
+ * samples_size, samples, frame_count)
+ * Descriptor: HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLE
+ * Optional by all HWC2 devices
+ *
+ * Collects the results of display content color sampling for display.
+ *
+ * Collection of data can occur whether the sampling is in ENABLE or
+ * DISABLE state.
+ *
+ * Parameters:
+ * max_frames - is the maximum number of frames that should be represented in
+ * the sample. The sample represents the most-recently posted frames.
+ * If max_frames is 0, all frames are to be represented by the sample.
+ * timestamp - is the timestamp after which any frames were posted that should
+ * be included in the sample. Timestamp is CLOCK_MONOTONIC.
+ * If timestamp is 0, do not filter from the sample by time.
+ * frame_count - The number of frames represented by this sample; pointer will
+ * be non-NULL.
+ * samples_size - The sizes of the color histogram representing the color
+ * sampling. Sample_sizes are indexed in the same order as
+ * HWC2_FORMAT_COMPONENT_.
+ * samples - The arrays of data corresponding to the sampling data. Samples are
+ * indexed in the same order as HWC2_FORMAT_COMPONENT_.
+ * The size of each sample is the samples_size for the same index.
+ * Each components sample is an array that is to be filled with the
+ * evenly-weighted buckets of a histogram counting how many times a pixel
+ * of the given component was displayed onscreen. Caller owns the data and
+ * pointer may be NULL to query samples_size.
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY when an invalid display was passed in, or
+ * HWC2_ERROR_UNSUPPORTED when there is no efficient way to sample, or
+ * HWC2_ERROR_BAD_PARAMETER when the component is not supported by the hardware.
+ */
+typedef int32_t (*HWC2_PFN_GET_DISPLAYED_CONTENT_SAMPLE)(
+ hwc2_device_t* device, hwc2_display_t display,
+ uint64_t max_frames, uint64_t timestamp,
+ uint64_t* frame_count, int32_t samples_size[4], uint64_t* samples[4]);
+
+/* getDisplayCapabilities(..., outCapabilities)
+ * Descriptor: HWC2_FUNCTION_GET_DISPLAY_CAPABILITIES
+ * Required for HWC2 devices for composer 2.3
+ * Optional for HWC2 devices for composer 2.1 and 2.2
+ *
+ * getDisplayCapabilities returns a list of supported capabilities
+ * (as described in the definition of Capability above).
+ * This list must not change after initialization.
+ *
+ * Parameters:
+ * outNumCapabilities - if outCapabilities was nullptr, returns the number of capabilities
+ * if outCapabilities was not nullptr, returns the number of capabilities stored in
+ * outCapabilities, which must not exceed the value stored in outNumCapabilities prior
+ * to the call; pointer will be non-NULL
+ * outCapabilities - a list of supported capabilities.
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_CAPABILITIES)(
+ hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumCapabilities,
+ uint32_t* outCapabilities);
+
+/* Use getDisplayCapabilities instead. If brightness is supported, must return
+ * DisplayCapability::BRIGHTNESS as one of the display capabilities via getDisplayCapabilities.
+ * Only use getDisplayCapabilities as the source of truth to query brightness support.
+ *
+ * getDisplayBrightnessSupport(displayToken)
+ * Descriptor: HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT
+ * Required for HWC2 devices for composer 2.3
+ * Optional for HWC2 devices for composer 2.1 and 2.2
+ *
+ * getDisplayBrightnessSupport returns whether brightness operations are supported on a display.
+ *
+ * Parameters:
+ * outSupport - whether the display supports operations.
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY when the display is invalid.
+ */
+typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_GET_DISPLAY_BRIGHTNESS_SUPPORT)(hwc2_device_t* device,
+ hwc2_display_t display, bool* outSupport);
+
+/* setDisplayBrightness(displayToken, brightnesss)
+ * Descriptor: HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS
+ * Required for HWC2 devices for composer 2.3
+ * Optional for HWC2 devices for composer 2.1 and 2.2
+ *
+ * setDisplayBrightness sets the brightness of a display.
+ *
+ * Parameters:
+ * brightness - a number between 0.0f (minimum brightness) and 1.0f (maximum brightness), or
+ * -1.0f to turn the backlight off.
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY when the display is invalid, or
+ * HWC2_ERROR_UNSUPPORTED when brightness operations are not supported, or
+ * HWC2_ERROR_BAD_PARAMETER when the brightness is invalid, or
+ * HWC2_ERROR_NO_RESOURCES when the brightness cannot be applied.
+ */
+typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_SET_DISPLAY_BRIGHTNESS)(hwc2_device_t* device,
+ hwc2_display_t display, float brightness);
+
__END_DECLS
#endif
diff --git a/include/hardware/keymaster_defs.h b/include/hardware/keymaster_defs.h
index cec486e..eca484c 100644
--- a/include/hardware/keymaster_defs.h
+++ b/include/hardware/keymaster_defs.h
@@ -112,7 +112,9 @@
KM_TAG_ALLOW_WHILE_ON_BODY = KM_BOOL | 506, /* Allow key to be used after authentication timeout
* if device is still on-body (requires secure
* on-body sensor. */
- KM_TAG_UNLOCKED_DEVICE_REQUIRED = KM_BOOL | 508, /* Require the device screen to be unlocked if the
+ KM_TAG_TRUSTED_CONFIRMATION_REQUIRED = KM_BOOL | 508, /* Require user confirmation through a
+ * trusted UI to use this key */
+ KM_TAG_UNLOCKED_DEVICE_REQUIRED = KM_BOOL | 509, /* Require the device screen to be unlocked if the
* key is used. */
/* Application access control */
@@ -454,6 +456,7 @@
KM_ERROR_KEYMASTER_NOT_CONFIGURED = -64,
KM_ERROR_ATTESTATION_APPLICATION_ID_MISSING = -65,
KM_ERROR_CANNOT_ATTEST_IDS = -66,
+ KM_ERROR_NO_USER_CONFIRMATION = -71,
KM_ERROR_DEVICE_LOCKED = -72,
KM_ERROR_UNIMPLEMENTED = -100,
@@ -586,7 +589,7 @@
return -1;
if (a->blob.data_length > b->blob.data_length)
return 1;
- };
+ }
}
return 0;
diff --git a/include/hardware/nfc-base.h b/include/hardware/nfc-base.h
index 6b63ad2..d22cd5d 100644
--- a/include/hardware/nfc-base.h
+++ b/include/hardware/nfc-base.h
@@ -1,6 +1,6 @@
// This file is autogenerated by hidl-gen. Do not edit manually.
// Source: android.hardware.nfc@1.0
-// Root: android.hardware:hardware/interfaces
+// Location: hardware/interfaces/nfc/1.0/
#ifndef HIDL_GENERATED_ANDROID_HARDWARE_NFC_V1_0_EXPORTED_CONSTANTS_H_
#define HIDL_GENERATED_ANDROID_HARDWARE_NFC_V1_0_EXPORTED_CONSTANTS_H_
@@ -10,21 +10,21 @@
#endif
enum {
- HAL_NFC_OPEN_CPLT_EVT = 0u, // 0
- HAL_NFC_CLOSE_CPLT_EVT = 1u, // 1
- HAL_NFC_POST_INIT_CPLT_EVT = 2u, // 2
- HAL_NFC_PRE_DISCOVER_CPLT_EVT = 3u, // 3
- HAL_NFC_REQUEST_CONTROL_EVT = 4u, // 4
- HAL_NFC_RELEASE_CONTROL_EVT = 5u, // 5
- HAL_NFC_ERROR_EVT = 6u, // 6
+ HAL_NFC_OPEN_CPLT_EVT = 0u,
+ HAL_NFC_CLOSE_CPLT_EVT = 1u,
+ HAL_NFC_POST_INIT_CPLT_EVT = 2u,
+ HAL_NFC_PRE_DISCOVER_CPLT_EVT = 3u,
+ HAL_NFC_REQUEST_CONTROL_EVT = 4u,
+ HAL_NFC_RELEASE_CONTROL_EVT = 5u,
+ HAL_NFC_ERROR_EVT = 6u,
};
enum {
- HAL_NFC_STATUS_OK = 0u, // 0
- HAL_NFC_STATUS_FAILED = 1u, // 1
- HAL_NFC_STATUS_ERR_TRANSPORT = 2u, // 2
- HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 3u, // 3
- HAL_NFC_STATUS_REFUSED = 4u, // 4
+ HAL_NFC_STATUS_OK = 0u,
+ HAL_NFC_STATUS_FAILED = 1u,
+ HAL_NFC_STATUS_ERR_TRANSPORT = 2u,
+ HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 3u,
+ HAL_NFC_STATUS_REFUSED = 4u,
};
#ifdef __cplusplus
diff --git a/include/hardware/sensors-base.h b/include/hardware/sensors-base.h
index b0f6223..a87cf52 100644
--- a/include/hardware/sensors-base.h
+++ b/include/hardware/sensors-base.h
@@ -1,6 +1,6 @@
// This file is autogenerated by hidl-gen. Do not edit manually.
// Source: android.hardware.sensors@1.0
-// Root: android.hardware:hardware/interfaces
+// Location: hardware/interfaces/sensors/1.0/
#ifndef HIDL_GENERATED_ANDROID_HARDWARE_SENSORS_V1_0_EXPORTED_CONSTANTS_H_
#define HIDL_GENERATED_ANDROID_HARDWARE_SENSORS_V1_0_EXPORTED_CONSTANTS_H_
@@ -51,23 +51,23 @@
SENSOR_TYPE_ADDITIONAL_INFO = 33,
SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT = 34,
SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 35,
- SENSOR_TYPE_DEVICE_PRIVATE_BASE = 65536, // 0x10000
+ SENSOR_TYPE_DEVICE_PRIVATE_BASE = 65536 /* 0x10000 */,
};
enum {
- SENSOR_FLAG_WAKE_UP = 1u, // 1
- SENSOR_FLAG_CONTINUOUS_MODE = 0u, // 0
- SENSOR_FLAG_ON_CHANGE_MODE = 2u, // 2
- SENSOR_FLAG_ONE_SHOT_MODE = 4u, // 4
- SENSOR_FLAG_SPECIAL_REPORTING_MODE = 6u, // 6
- SENSOR_FLAG_DATA_INJECTION = 16u, // 0x10
- SENSOR_FLAG_DYNAMIC_SENSOR = 32u, // 0x20
- SENSOR_FLAG_ADDITIONAL_INFO = 64u, // 0x40
- SENSOR_FLAG_DIRECT_CHANNEL_ASHMEM = 1024u, // 0x400
- SENSOR_FLAG_DIRECT_CHANNEL_GRALLOC = 2048u, // 0x800
- SENSOR_FLAG_MASK_REPORTING_MODE = 14u, // 0xE
- SENSOR_FLAG_MASK_DIRECT_REPORT = 896u, // 0x380
- SENSOR_FLAG_MASK_DIRECT_CHANNEL = 3072u, // 0xC00
+ SENSOR_FLAG_WAKE_UP = 1u,
+ SENSOR_FLAG_CONTINUOUS_MODE = 0u,
+ SENSOR_FLAG_ON_CHANGE_MODE = 2u,
+ SENSOR_FLAG_ONE_SHOT_MODE = 4u,
+ SENSOR_FLAG_SPECIAL_REPORTING_MODE = 6u,
+ SENSOR_FLAG_DATA_INJECTION = 16u /* 0x10 */,
+ SENSOR_FLAG_DYNAMIC_SENSOR = 32u /* 0x20 */,
+ SENSOR_FLAG_ADDITIONAL_INFO = 64u /* 0x40 */,
+ SENSOR_FLAG_DIRECT_CHANNEL_ASHMEM = 1024u /* 0x400 */,
+ SENSOR_FLAG_DIRECT_CHANNEL_GRALLOC = 2048u /* 0x800 */,
+ SENSOR_FLAG_MASK_REPORTING_MODE = 14u /* 0xE */,
+ SENSOR_FLAG_MASK_DIRECT_REPORT = 896u /* 0x380 */,
+ SENSOR_FLAG_MASK_DIRECT_CHANNEL = 3072u /* 0xC00 */,
};
typedef enum {
@@ -80,7 +80,7 @@
} sensor_flag_shift_t;
enum {
- SENSOR_STATUS_NO_CONTACT = -1, // (-1)
+ SENSOR_STATUS_NO_CONTACT = -1 /* (-1) */,
SENSOR_STATUS_UNRELIABLE = 0,
SENSOR_STATUS_ACCURACY_LOW = 1,
SENSOR_STATUS_ACCURACY_MEDIUM = 2,
@@ -88,42 +88,42 @@
};
enum {
- META_DATA_FLUSH_COMPLETE = 1u, // 1
+ META_DATA_FLUSH_COMPLETE = 1u,
};
typedef enum {
- AINFO_BEGIN = 0u, // 0
- AINFO_END = 1u, // 1
- AINFO_UNTRACKED_DELAY = 65536u, // 0x10000
- AINFO_INTERNAL_TEMPERATURE = 65537u, // 65537
- AINFO_VEC3_CALIBRATION = 65538u, // 65538
- AINFO_SENSOR_PLACEMENT = 65539u, // 65539
- AINFO_SAMPLING = 65540u, // 65540
- AINFO_CHANNEL_NOISE = 131072u, // 0x20000
- AINFO_CHANNEL_SAMPLER = 131073u, // 131073
- AINFO_CHANNEL_FILTER = 131074u, // 131074
- AINFO_CHANNEL_LINEAR_TRANSFORM = 131075u, // 131075
- AINFO_CHANNEL_NONLINEAR_MAP = 131076u, // 131076
- AINFO_CHANNEL_RESAMPLER = 131077u, // 131077
- AINFO_LOCAL_GEOMAGNETIC_FIELD = 196608u, // 0x30000
- AINFO_LOCAL_GRAVITY = 196609u, // 196609
- AINFO_DOCK_STATE = 196610u, // 196610
- AINFO_HIGH_PERFORMANCE_MODE = 196611u, // 196611
- AINFO_MAGNETIC_FIELD_CALIBRATION = 196612u, // 196612
- AINFO_CUSTOM_START = 268435456u, // 0x10000000
- AINFO_DEBUGGING_START = 1073741824u, // 0x40000000
+ AINFO_BEGIN = 0u,
+ AINFO_END = 1u,
+ AINFO_UNTRACKED_DELAY = 65536u /* 0x10000 */,
+ AINFO_INTERNAL_TEMPERATURE = 65537u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_UNTRACKED_DELAY implicitly + 1) */,
+ AINFO_VEC3_CALIBRATION = 65538u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_INTERNAL_TEMPERATURE implicitly + 1) */,
+ AINFO_SENSOR_PLACEMENT = 65539u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_VEC3_CALIBRATION implicitly + 1) */,
+ AINFO_SAMPLING = 65540u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_SENSOR_PLACEMENT implicitly + 1) */,
+ AINFO_CHANNEL_NOISE = 131072u /* 0x20000 */,
+ AINFO_CHANNEL_SAMPLER = 131073u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_NOISE implicitly + 1) */,
+ AINFO_CHANNEL_FILTER = 131074u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_SAMPLER implicitly + 1) */,
+ AINFO_CHANNEL_LINEAR_TRANSFORM = 131075u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_FILTER implicitly + 1) */,
+ AINFO_CHANNEL_NONLINEAR_MAP = 131076u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_LINEAR_TRANSFORM implicitly + 1) */,
+ AINFO_CHANNEL_RESAMPLER = 131077u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_NONLINEAR_MAP implicitly + 1) */,
+ AINFO_LOCAL_GEOMAGNETIC_FIELD = 196608u /* 0x30000 */,
+ AINFO_LOCAL_GRAVITY = 196609u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_LOCAL_GEOMAGNETIC_FIELD implicitly + 1) */,
+ AINFO_DOCK_STATE = 196610u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_LOCAL_GRAVITY implicitly + 1) */,
+ AINFO_HIGH_PERFORMANCE_MODE = 196611u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_DOCK_STATE implicitly + 1) */,
+ AINFO_MAGNETIC_FIELD_CALIBRATION = 196612u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_HIGH_PERFORMANCE_MODE implicitly + 1) */,
+ AINFO_CUSTOM_START = 268435456u /* 0x10000000 */,
+ AINFO_DEBUGGING_START = 1073741824u /* 0x40000000 */,
} additional_info_type_t;
typedef enum {
SENSOR_DIRECT_RATE_STOP = 0,
- SENSOR_DIRECT_RATE_NORMAL = 1,
- SENSOR_DIRECT_RATE_FAST = 2,
- SENSOR_DIRECT_RATE_VERY_FAST = 3,
+ SENSOR_DIRECT_RATE_NORMAL = 1 /* (::android::hardware::sensors::V1_0::RateLevel.STOP implicitly + 1) */,
+ SENSOR_DIRECT_RATE_FAST = 2 /* (::android::hardware::sensors::V1_0::RateLevel.NORMAL implicitly + 1) */,
+ SENSOR_DIRECT_RATE_VERY_FAST = 3 /* (::android::hardware::sensors::V1_0::RateLevel.FAST implicitly + 1) */,
} direct_rate_level_t;
typedef enum {
SENSOR_DIRECT_MEM_TYPE_ASHMEM = 1,
- SENSOR_DIRECT_MEM_TYPE_GRALLOC = 2,
+ SENSOR_DIRECT_MEM_TYPE_GRALLOC = 2 /* (::android::hardware::sensors::V1_0::SharedMemType.ASHMEM implicitly + 1) */,
} direct_mem_type_t;
typedef enum {
diff --git a/include/hardware/sound_trigger.h b/include/hardware/sound_trigger.h
index d7828ac..99346ef 100644
--- a/include/hardware/sound_trigger.h
+++ b/include/hardware/sound_trigger.h
@@ -40,7 +40,8 @@
#define SOUND_TRIGGER_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
#define SOUND_TRIGGER_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION(1, 1)
-#define SOUND_TRIGGER_DEVICE_API_VERSION_CURRENT SOUND_TRIGGER_DEVICE_API_VERSION_1_1
+#define SOUND_TRIGGER_DEVICE_API_VERSION_1_2 HARDWARE_DEVICE_API_VERSION(1, 2)
+#define SOUND_TRIGGER_DEVICE_API_VERSION_CURRENT SOUND_TRIGGER_DEVICE_API_VERSION_1_2
/**
* List of known sound trigger HAL modules. This is the base name of the sound_trigger HAL
@@ -114,6 +115,14 @@
* If no implementation is provided, stop_recognition will be called for each running model.
*/
int (*stop_all_recognitions)(const struct sound_trigger_hw_device* dev);
+
+ /* Get the current state of a given model.
+ * The state will be returned as a recognition event, via the callback that was registered
+ * in the start_recognition method.
+ * Only supported for device api versions SOUND_TRIGGER_DEVICE_API_VERSION_1_2 or above.
+ */
+ int (*get_model_state)(const struct sound_trigger_hw_device *dev,
+ sound_model_handle_t sound_model_handle);
};
typedef struct sound_trigger_hw_device sound_trigger_hw_device_t;
diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp
index 8c0c097..833c12b 100644
--- a/modules/audio_remote_submix/audio_hw.cpp
+++ b/modules/audio_remote_submix/audio_hw.cpp
@@ -488,17 +488,26 @@
ALOGV("submix_audio_device_destroy_pipe_l()");
int route_idx = -1;
if (in != NULL) {
+ bool shut_down = false;
#if ENABLE_LEGACY_INPUT_OPEN
const_cast<struct submix_stream_in*>(in)->ref_count--;
route_idx = in->route_handle;
ALOG_ASSERT(rsxadev->routes[route_idx].input == in);
if (in->ref_count == 0) {
rsxadev->routes[route_idx].input = NULL;
+ shut_down = true;
}
ALOGV("submix_audio_device_destroy_pipe_l(): input ref_count %d", in->ref_count);
#else
rsxadev->input = NULL;
+ shut_down = true;
#endif // ENABLE_LEGACY_INPUT_OPEN
+ if (shut_down) {
+ sp <MonoPipe> sink = rsxadev->routes[in->route_handle].rsxSink;
+ if (sink != NULL) {
+ sink->shutdown(true);
+ }
+ }
}
if (out != NULL) {
route_idx = out->route_handle;
@@ -796,6 +805,11 @@
// the pipe has already been shutdown, this buffer will be lost but we must
// simulate timing so we don't drain the output faster than realtime
usleep(frames * 1000000 / out_get_sample_rate(&stream->common));
+
+ pthread_mutex_lock(&rsxadev->lock);
+ out->frames_written += frames;
+ out->frames_written_since_standby += frames;
+ pthread_mutex_unlock(&rsxadev->lock);
return bytes;
}
} else {
@@ -1648,6 +1662,12 @@
ALOGV("adev_open_input_stream(): about to create pipe");
submix_audio_device_create_pipe_l(rsxadev, config, DEFAULT_PIPE_SIZE_IN_FRAMES,
DEFAULT_PIPE_PERIOD_COUNT, in, NULL, address, route_idx);
+
+ sp <MonoPipe> sink = rsxadev->routes[route_idx].rsxSink;
+ if (sink != NULL) {
+ sink->shutdown(false);
+ }
+
#if LOG_STREAMS_TO_FILES
if (in->log_fd >= 0) close(in->log_fd);
in->log_fd = open(LOG_STREAM_IN_FILENAME, O_CREAT | O_TRUNC | O_WRONLY,
diff --git a/modules/camera/3_4/Android.mk b/modules/camera/3_4/Android.mk
index 6ecedac..0a11f68 100644
--- a/modules/camera/3_4/Android.mk
+++ b/modules/camera/3_4/Android.mk
@@ -36,7 +36,7 @@
libyuv_static \
libjpeg_static_ndk \
-v4l2_cflags := -fno-short-enums -Wall -Wno-error -Wextra -fvisibility=hidden -DHAVE_JPEG
+v4l2_cflags := -fno-short-enums -Wall -Wextra -Werror -fvisibility=hidden -DHAVE_JPEG
v4l2_c_includes := $(call include-path-for, camera) \
external/libyuv/files/include \
@@ -106,7 +106,6 @@
LOCAL_CFLAGS += $(v4l2_cflags)
LOCAL_SHARED_LIBRARIES := $(v4l2_shared_libs)
LOCAL_STATIC_LIBRARIES := \
- libBionicGtestMain \
libgmock \
$(v4l2_static_libs) \
diff --git a/modules/camera/3_4/README.md b/modules/camera/3_4/README.md
index 168ba97..8c682e9 100644
--- a/modules/camera/3_4/README.md
+++ b/modules/camera/3_4/README.md
@@ -6,6 +6,14 @@
introduce some [caveats](#V4L2-Deficiencies), causing this HAL to
not be fully spec-compliant.
+## Current status
+
+People are free to use that library if that works for their purpose,
+but it's not maintained by Android Camera team. There is another V4L2
+camera HAL implementation which is maintained by Android Camera team
+starting in Android P. See more information
+[here](https://source.android.com/devices/camera/external-usb-cameras).
+
## Building a Device with the HAL
To ensure the HAL is built for a device, include the following in your
diff --git a/modules/camera/3_4/arc/cached_frame.cpp b/modules/camera/3_4/arc/cached_frame.cpp
index 0489be8..1c33d85 100644
--- a/modules/camera/3_4/arc/cached_frame.cpp
+++ b/modules/camera/3_4/arc/cached_frame.cpp
@@ -5,11 +5,10 @@
#include "arc/cached_frame.h"
-#include <errno.h>
-#include <libyuv.h>
+#include <cerrno>
+#include <libyuv.h>
#include "arc/common.h"
-#include "arc/common_types.h"
namespace arc {
@@ -18,7 +17,8 @@
CachedFrame::CachedFrame()
: source_frame_(nullptr),
cropped_buffer_capacity_(0),
- yu12_frame_(new AllocatedFrameBuffer(0)) {}
+ yu12_frame_(new AllocatedFrameBuffer(0)),
+ scaled_frame_(new AllocatedFrameBuffer(0)) {}
CachedFrame::~CachedFrame() { UnsetSource(); }
diff --git a/modules/camera/3_4/arc/cached_frame.h b/modules/camera/3_4/arc/cached_frame.h
index fbfcb76..a16c2a6 100644
--- a/modules/camera/3_4/arc/cached_frame.h
+++ b/modules/camera/3_4/arc/cached_frame.h
@@ -9,7 +9,6 @@
#include <memory>
#include <camera/CameraMetadata.h>
-
#include "arc/image_processor.h"
namespace arc {
diff --git a/modules/camera/3_4/arc/exif_utils.cpp b/modules/camera/3_4/arc/exif_utils.cpp
index aec53c5..5e8c756 100644
--- a/modules/camera/3_4/arc/exif_utils.cpp
+++ b/modules/camera/3_4/arc/exif_utils.cpp
@@ -10,7 +10,6 @@
#include <ctime>
#include <libyuv.h>
-
#include "arc/common.h"
namespace std {
diff --git a/modules/camera/3_4/arc/frame_buffer.cpp b/modules/camera/3_4/arc/frame_buffer.cpp
index 4ae0fe3..51a7320 100644
--- a/modules/camera/3_4/arc/frame_buffer.cpp
+++ b/modules/camera/3_4/arc/frame_buffer.cpp
@@ -5,10 +5,9 @@
#include "arc/frame_buffer.h"
-#include <sys/mman.h>
-
#include <utility>
+#include <sys/mman.h>
#include "arc/common.h"
#include "arc/image_processor.h"
diff --git a/modules/camera/3_4/arc/frame_buffer.h b/modules/camera/3_4/arc/frame_buffer.h
index 3efeb3b..6a90feb 100644
--- a/modules/camera/3_4/arc/frame_buffer.h
+++ b/modules/camera/3_4/arc/frame_buffer.h
@@ -6,14 +6,11 @@
#ifndef HAL_USB_FRAME_BUFFER_H_
#define HAL_USB_FRAME_BUFFER_H_
-#include <stdint.h>
-
+#include <cstdint>
#include <memory>
-#include <string>
#include <base/files/scoped_file.h>
#include <base/synchronization/lock.h>
-
#include <hardware/gralloc.h>
namespace arc {
diff --git a/modules/camera/3_4/arc/image_processor.cpp b/modules/camera/3_4/arc/image_processor.cpp
index f0fee91..ee28c0b 100644
--- a/modules/camera/3_4/arc/image_processor.cpp
+++ b/modules/camera/3_4/arc/image_processor.cpp
@@ -5,12 +5,12 @@
#include "arc/image_processor.h"
-#include <errno.h>
-#include <libyuv.h>
-#include <time.h>
+#include <cerrno>
+#include <ctime>
+#include <string>
+#include <libyuv.h>
#include "arc/common.h"
-#include "arc/common_types.h"
#include "arc/exif_utils.h"
#include "arc/jpeg_compressor.h"
@@ -85,6 +85,8 @@
case V4L2_PIX_FMT_BGR32:
case V4L2_PIX_FMT_RGB32:
return width * height * 4;
+ case V4L2_PIX_FMT_JPEG:
+ return 0; // For JPEG real size will be calculated after conversion.
default:
LOGF(ERROR) << "Pixel format " << FormatToString(fourcc)
<< " is unsupported.";
@@ -388,6 +390,9 @@
return false;
}
size_t buffer_length = compressor.GetCompressedImageSize();
+ if (out_frame->SetDataSize(buffer_length)) {
+ return false;
+ }
memcpy(out_frame->GetData(), compressor.GetCompressedImagePtr(),
buffer_length);
return true;
diff --git a/modules/camera/3_4/arc/image_processor.h b/modules/camera/3_4/arc/image_processor.h
index 323680a..46bb7b4 100644
--- a/modules/camera/3_4/arc/image_processor.h
+++ b/modules/camera/3_4/arc/image_processor.h
@@ -6,14 +6,12 @@
#ifndef HAL_USB_IMAGE_PROCESSOR_H_
#define HAL_USB_IMAGE_PROCESSOR_H_
-#include <string>
-
+#include <camera/CameraMetadata.h>
// FourCC pixel formats (defined as V4L2_PIX_FMT_*).
#include <linux/videodev2.h>
// Declarations of HAL_PIXEL_FORMAT_XXX.
#include <system/graphics.h>
-#include <camera/CameraMetadata.h>
#include "frame_buffer.h"
namespace arc {
diff --git a/modules/camera/3_4/arc/jpeg_compressor.cpp b/modules/camera/3_4/arc/jpeg_compressor.cpp
index 7c61b40..0a7b20b 100644
--- a/modules/camera/3_4/arc/jpeg_compressor.cpp
+++ b/modules/camera/3_4/arc/jpeg_compressor.cpp
@@ -8,8 +8,6 @@
#include <memory>
-#include <errno.h>
-
#include "arc/common.h"
namespace arc {
diff --git a/modules/camera/3_4/arc/jpeg_compressor.h b/modules/camera/3_4/arc/jpeg_compressor.h
index 378f3cd..499b9aa 100644
--- a/modules/camera/3_4/arc/jpeg_compressor.h
+++ b/modules/camera/3_4/arc/jpeg_compressor.h
@@ -9,7 +9,6 @@
// We must include cstdio before jpeglib.h. It is a requirement of libjpeg.
#include <cstdio>
-#include <string>
#include <vector>
extern "C" {
diff --git a/modules/camera/3_4/camera.cpp b/modules/camera/3_4/camera.cpp
index 79dca0b..7636cba 100644
--- a/modules/camera/3_4/camera.cpp
+++ b/modules/camera/3_4/camera.cpp
@@ -16,27 +16,24 @@
// Modified from hardware/libhardware/modules/camera/Camera.cpp
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Camera"
+
+#include "camera.h"
+
#include <cstdlib>
#include <memory>
-#include <vector>
-#include <stdio.h>
+
#include <hardware/camera3.h>
#include <sync/sync.h>
#include <system/camera_metadata.h>
#include <system/graphics.h>
-#include <utils/Mutex.h>
-
#include "metadata/metadata_common.h"
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "Camera"
-#include <cutils/log.h>
+#include "static_properties.h"
#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
#include <utils/Trace.h>
-#include "camera.h"
-
#define CAMERA_SYNC_TIMEOUT 5000 // in msecs
namespace default_camera_hal {
@@ -75,7 +72,7 @@
{
ALOGI("%s:%d: Opening camera device", __func__, mId);
ATRACE_CALL();
- android::Mutex::Autolock al(mDeviceLock);
+ android::Mutex::Autolock dl(mDeviceLock);
if (mBusy) {
ALOGE("%s:%d: Error! Camera device already opened", __func__, mId);
@@ -112,7 +109,7 @@
int Camera::loadStaticInfo() {
// Using a lock here ensures |mStaticInfo| will only ever be set once,
// even in concurrent situations.
- android::Mutex::Autolock al(mStaticInfoLock);
+ android::Mutex::Autolock sl(mStaticInfoLock);
if (mStaticInfo) {
return 0;
@@ -142,7 +139,7 @@
{
ALOGI("%s:%d: Closing camera device", __func__, mId);
ATRACE_CALL();
- android::Mutex::Autolock al(mDeviceLock);
+ android::Mutex::Autolock dl(mDeviceLock);
if (!mBusy) {
ALOGE("%s:%d: Error! Camera device not open", __func__, mId);
@@ -172,7 +169,8 @@
int Camera::configureStreams(camera3_stream_configuration_t *stream_config)
{
- android::Mutex::Autolock al(mDeviceLock);
+ android::Mutex::Autolock dl(mDeviceLock);
+ android::Mutex::Autolock tl(mInFlightTrackerLock);
ALOGV("%s:%d: stream_config=%p", __func__, mId, stream_config);
ATRACE_CALL();
@@ -301,7 +299,7 @@
int res;
// TODO(b/32917568): A capture request submitted or ongoing during a flush
// should be returned with an error; for now they are mutually exclusive.
- android::Mutex::Autolock al(mFlushLock);
+ android::Mutex::Autolock tl(mInFlightTrackerLock);
ATRACE_CALL();
@@ -343,7 +341,7 @@
// Pre-process output buffers.
if (request->output_buffers.size() <= 0) {
- ALOGE("%s:%d: Invalid number of output buffers: %d", __func__, mId,
+ ALOGE("%s:%d: Invalid number of output buffers: %zu", __func__, mId,
request->output_buffers.size());
return -EINVAL;
}
@@ -375,6 +373,8 @@
void Camera::completeRequest(std::shared_ptr<CaptureRequest> request, int err)
{
+ android::Mutex::Autolock tl(mInFlightTrackerLock);
+
if (!mInFlightTracker->Remove(request)) {
ALOGE("%s:%d: Completed request %p is not being tracked. "
"It may have been cleared out during a flush.",
@@ -423,7 +423,7 @@
// is called concurrently with this (in either order).
// Since the callback to completeRequest also may happen on a separate
// thread, this function should behave nicely concurrently with that too.
- android::Mutex::Autolock al(mFlushLock);
+ android::Mutex::Autolock tl(mInFlightTrackerLock);
std::set<std::shared_ptr<CaptureRequest>> requests;
mInFlightTracker->Clear(&requests);
@@ -433,7 +433,7 @@
completeRequestWithError(request);
}
- ALOGV("%s:%d: Flushed %u requests.", __func__, mId, requests.size());
+ ALOGV("%s:%d: Flushed %zu requests.", __func__, mId, requests.size());
// Call down into the device flushing.
return flushBuffers();
@@ -503,7 +503,10 @@
static_cast<uint32_t>(request->output_buffers.size()),
request->output_buffers.data(),
request->input_buffer.get(),
- 1 // Total result; only 1 part.
+ 1, // Total result; only 1 part.
+ 0, // Number of physical camera metadata.
+ nullptr,
+ nullptr
};
// Make the framework callback.
mCallbackOps->process_capture_result(mCallbackOps, &result);
@@ -513,7 +516,7 @@
{
ALOGV("%s:%d: Dumping to fd %d", __func__, mId, fd);
ATRACE_CALL();
- android::Mutex::Autolock al(mDeviceLock);
+ android::Mutex::Autolock dl(mDeviceLock);
dprintf(fd, "Camera ID: %d (Busy: %d)\n", mId, mBusy);
diff --git a/modules/camera/3_4/camera.h b/modules/camera/3_4/camera.h
index 687c733..8c49c8d 100644
--- a/modules/camera/3_4/camera.h
+++ b/modules/camera/3_4/camera.h
@@ -134,11 +134,11 @@
// Lock protecting only static camera characteristics, which may
// be accessed without the camera device open
android::Mutex mStaticInfoLock;
- android::Mutex mFlushLock;
// Standard camera settings templates
std::unique_ptr<const android::CameraMetadata> mTemplates[CAMERA3_TEMPLATE_COUNT];
// Track in flight requests.
std::unique_ptr<RequestTracker> mInFlightTracker;
+ android::Mutex mInFlightTrackerLock;
};
} // namespace default_camera_hal
diff --git a/modules/camera/3_4/capture_request.cpp b/modules/camera/3_4/capture_request.cpp
index 00b20cd..beef72f 100644
--- a/modules/camera/3_4/capture_request.cpp
+++ b/modules/camera/3_4/capture_request.cpp
@@ -16,8 +16,6 @@
#include "capture_request.h"
-#include <set>
-
namespace default_camera_hal {
CaptureRequest::CaptureRequest() : CaptureRequest(nullptr) {}
diff --git a/modules/camera/3_4/common.h b/modules/camera/3_4/common.h
index ca5151d..48cf2bd 100644
--- a/modules/camera/3_4/common.h
+++ b/modules/camera/3_4/common.h
@@ -17,11 +17,8 @@
#ifndef V4L2_CAMERA_HAL_COMMON_H_
#define V4L2_CAMERA_HAL_COMMON_H_
-// #define LOG_NDEBUG 0
#include <cutils/log.h>
-#define LOG_TAG "V4L2CameraHAL"
-
// Helpers of logging (showing function name and line number).
#define HAL_LOGE(fmt, args...) do { \
ALOGE("%s:%d: " fmt, __func__, __LINE__, ##args); \
@@ -59,11 +56,4 @@
#define HAL_LOG_ENTER() HAL_LOGV("enter")
#define HAL_LOG_EXIT() HAL_LOGV("exit")
-// Fix confliction in case it's defined elsewhere.
-#ifndef DISALLOW_COPY_AND_ASSIGN
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName&); \
- void operator=(const TypeName&);
-#endif
-
#endif // V4L2_CAMERA_HAL_COMMON_H_
diff --git a/modules/camera/3_4/format_metadata_factory.cpp b/modules/camera/3_4/format_metadata_factory.cpp
index db03678..3469b06 100644
--- a/modules/camera/3_4/format_metadata_factory.cpp
+++ b/modules/camera/3_4/format_metadata_factory.cpp
@@ -14,9 +14,16 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "FormatMetadataFactory"
+
#include "format_metadata_factory.h"
+#include <algorithm>
+#include <set>
+
#include "arc/image_processor.h"
+#include "common.h"
#include "metadata/array_vector.h"
#include "metadata/partial_metadata_factory.h"
#include "metadata/property.h"
@@ -101,7 +108,7 @@
return res;
}
- HAL_LOGI("Supports %d qualified formats.", qualified_formats.size());
+ HAL_LOGI("Supports %zu qualified formats.", qualified_formats.size());
// Find sizes and frame/stall durations for all formats.
// We also want to find the smallest max frame duration amongst all formats,
diff --git a/modules/camera/3_4/format_metadata_factory.h b/modules/camera/3_4/format_metadata_factory.h
index 23c1777..cd25f9c 100644
--- a/modules/camera/3_4/format_metadata_factory.h
+++ b/modules/camera/3_4/format_metadata_factory.h
@@ -17,12 +17,9 @@
#ifndef V4L2_CAMERA_HAL_FORMAT_METADATA_FACTORY_H_
#define V4L2_CAMERA_HAL_FORMAT_METADATA_FACTORY_H_
-#include <algorithm>
#include <iterator>
#include <memory>
-#include <set>
-#include "common.h"
#include "metadata/metadata_common.h"
#include "v4l2_wrapper.h"
diff --git a/modules/camera/3_4/format_metadata_factory_test.cpp b/modules/camera/3_4/format_metadata_factory_test.cpp
index fe5d67f..65d4415 100644
--- a/modules/camera/3_4/format_metadata_factory_test.cpp
+++ b/modules/camera/3_4/format_metadata_factory_test.cpp
@@ -14,11 +14,12 @@
* limitations under the License.
*/
+#include "format_metadata_factory.h"
+
#include <camera/CameraMetadata.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include "format_metadata_factory.h"
#include "metadata/test_common.h"
#include "v4l2_wrapper_mock.h"
diff --git a/modules/camera/3_4/function_thread.h b/modules/camera/3_4/function_thread.h
index 7a7b1e3..44bf061 100644
--- a/modules/camera/3_4/function_thread.h
+++ b/modules/camera/3_4/function_thread.h
@@ -21,8 +21,6 @@
#include <utils/Thread.h>
-#include "common.h"
-
namespace v4l2_camera_hal {
class FunctionThread : public android::Thread {
diff --git a/modules/camera/3_4/metadata/boottime_state_delegate.cpp b/modules/camera/3_4/metadata/boottime_state_delegate.cpp
index 5024cb2..4ea6818 100644
--- a/modules/camera/3_4/metadata/boottime_state_delegate.cpp
+++ b/modules/camera/3_4/metadata/boottime_state_delegate.cpp
@@ -14,11 +14,16 @@
* limitations under the License.
*/
-#include <errno.h>
-#include <string.h>
+//#define LOG_NDEBUG 0
+#define LOG_TAG "BoottimeStateDelegate"
#include "boottime_state_delegate.h"
+#include <cerrno>
+#include <cstring>
+
+#include "common.h"
+
namespace v4l2_camera_hal {
int BoottimeStateDelegate::GetValue(int64_t* value) {
diff --git a/modules/camera/3_4/metadata/boottime_state_delegate.h b/modules/camera/3_4/metadata/boottime_state_delegate.h
index 0a5c4b9..e31e12f 100644
--- a/modules/camera/3_4/metadata/boottime_state_delegate.h
+++ b/modules/camera/3_4/metadata/boottime_state_delegate.h
@@ -17,7 +17,8 @@
#ifndef V4L2_CAMERA_HAL_METADATA_BOOTTIME_STATE_DELEGATE_H_
#define V4L2_CAMERA_HAL_METADATA_BOOTTIME_STATE_DELEGATE_H_
-#include "../common.h"
+#include <cstdint>
+
#include "state_delegate_interface.h"
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/control.h b/modules/camera/3_4/metadata/control.h
index ad3f87b..35f4d04 100644
--- a/modules/camera/3_4/metadata/control.h
+++ b/modules/camera/3_4/metadata/control.h
@@ -19,9 +19,8 @@
#include <vector>
+#include <android-base/macros.h>
#include <system/camera_metadata.h>
-
-#include "../common.h"
#include "metadata_common.h"
#include "partial_metadata_interface.h"
#include "tagged_control_delegate.h"
diff --git a/modules/camera/3_4/metadata/control_delegate_interface_mock.h b/modules/camera/3_4/metadata/control_delegate_interface_mock.h
index 7ed05ed..9a0ca04 100644
--- a/modules/camera/3_4/metadata/control_delegate_interface_mock.h
+++ b/modules/camera/3_4/metadata/control_delegate_interface_mock.h
@@ -19,10 +19,10 @@
#ifndef V4L2_CAMERA_HAL_METADATA_CONTROL_DELEGATE_INTERFACE_MOCK_H_
#define V4L2_CAMERA_HAL_METADATA_CONTROL_DELEGATE_INTERFACE_MOCK_H_
-#include <gmock/gmock.h>
-
#include "control_delegate_interface.h"
+#include <gmock/gmock.h>
+
namespace v4l2_camera_hal {
template <typename T>
diff --git a/modules/camera/3_4/metadata/control_options_interface_mock.h b/modules/camera/3_4/metadata/control_options_interface_mock.h
index ab8f6ee..2492880 100644
--- a/modules/camera/3_4/metadata/control_options_interface_mock.h
+++ b/modules/camera/3_4/metadata/control_options_interface_mock.h
@@ -19,10 +19,10 @@
#ifndef V4L2_CAMERA_HAL_METADATA_CONTROL_OPTIONS_INTERFACE_MOCK_H_
#define V4L2_CAMERA_HAL_METADATA_CONTROL_OPTIONS_INTERFACE_MOCK_H_
-#include <gmock/gmock.h>
-
#include "control_options_interface.h"
+#include <gmock/gmock.h>
+
namespace v4l2_camera_hal {
template <typename T>
diff --git a/modules/camera/3_4/metadata/converter_interface.h b/modules/camera/3_4/metadata/converter_interface.h
index ca6a0f2..fa960e9 100644
--- a/modules/camera/3_4/metadata/converter_interface.h
+++ b/modules/camera/3_4/metadata/converter_interface.h
@@ -17,8 +17,6 @@
#ifndef V4L2_CAMERA_HAL_METADATA_CONVERTER_INTERFACE_H_
#define V4L2_CAMERA_HAL_METADATA_CONVERTER_INTERFACE_H_
-#include "../common.h"
-
namespace v4l2_camera_hal {
// A ConverterInterface converts metadata values to V4L2 values vice-versa.
diff --git a/modules/camera/3_4/metadata/converter_interface_mock.h b/modules/camera/3_4/metadata/converter_interface_mock.h
index 3f7e6f7..19d618a 100644
--- a/modules/camera/3_4/metadata/converter_interface_mock.h
+++ b/modules/camera/3_4/metadata/converter_interface_mock.h
@@ -19,10 +19,10 @@
#ifndef V4L2_CAMERA_HAL_METADATA_CONVERTER_INTERFACE_MOCK_H_
#define V4L2_CAMERA_HAL_METADATA_CONVERTER_INTERFACE_MOCK_H_
-#include <gmock/gmock.h>
-
#include "converter_interface.h"
+#include <gmock/gmock.h>
+
namespace v4l2_camera_hal {
template <typename TMetadata, typename TV4L2>
diff --git a/modules/camera/3_4/metadata/default_option_delegate.h b/modules/camera/3_4/metadata/default_option_delegate.h
index f290318..d3d66c5 100644
--- a/modules/camera/3_4/metadata/default_option_delegate.h
+++ b/modules/camera/3_4/metadata/default_option_delegate.h
@@ -17,8 +17,6 @@
#ifndef V4L2_CAMERA_HAL_METADATA_DEFAULT_OPTION_DELEGATE_H_
#define V4L2_CAMERA_HAL_METADATA_DEFAULT_OPTION_DELEGATE_H_
-#include <errno.h>
-
#include <map>
#include <hardware/camera3.h>
diff --git a/modules/camera/3_4/metadata/default_option_delegate_mock.h b/modules/camera/3_4/metadata/default_option_delegate_mock.h
index 84ec740..6b80071 100644
--- a/modules/camera/3_4/metadata/default_option_delegate_mock.h
+++ b/modules/camera/3_4/metadata/default_option_delegate_mock.h
@@ -19,10 +19,10 @@
#ifndef V4L2_CAMERA_HAL_METADATA_DEFAULT_OPTION_DELEGATE_MOCK_H_
#define V4L2_CAMERA_HAL_METADATA_DEFAULT_OPTION_DELEGATE_MOCK_H_
-#include <gmock/gmock.h>
-
#include "default_option_delegate.h"
+#include <gmock/gmock.h>
+
namespace v4l2_camera_hal {
template <typename T>
diff --git a/modules/camera/3_4/metadata/enum_converter.cpp b/modules/camera/3_4/metadata/enum_converter.cpp
index d5e0a87..580e7e1 100644
--- a/modules/camera/3_4/metadata/enum_converter.cpp
+++ b/modules/camera/3_4/metadata/enum_converter.cpp
@@ -14,11 +14,14 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "EnumConverter"
+
#include "enum_converter.h"
-#include <errno.h>
+#include <cerrno>
-#include "../common.h"
+#include "common.h"
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/enum_converter.h b/modules/camera/3_4/metadata/enum_converter.h
index df5cabb..855f430 100644
--- a/modules/camera/3_4/metadata/enum_converter.h
+++ b/modules/camera/3_4/metadata/enum_converter.h
@@ -19,7 +19,7 @@
#include <map>
-#include "../common.h"
+#include <android-base/macros.h>
#include "converter_interface.h"
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/enum_converter_test.cpp b/modules/camera/3_4/metadata/enum_converter_test.cpp
index 9ba7ffc..1f27884 100644
--- a/modules/camera/3_4/metadata/enum_converter_test.cpp
+++ b/modules/camera/3_4/metadata/enum_converter_test.cpp
@@ -16,7 +16,6 @@
#include "enum_converter.h"
-#include <gmock/gmock.h>
#include <gtest/gtest.h>
using testing::Test;
diff --git a/modules/camera/3_4/metadata/ignored_control_delegate.h b/modules/camera/3_4/metadata/ignored_control_delegate.h
index f1d5da1..dce457b 100644
--- a/modules/camera/3_4/metadata/ignored_control_delegate.h
+++ b/modules/camera/3_4/metadata/ignored_control_delegate.h
@@ -32,7 +32,7 @@
*value = value_;
return 0;
};
- int SetValue(const T& value) override { return 0; };
+ int SetValue(const T& /*value*/) override { return 0; };
private:
const T value_;
diff --git a/modules/camera/3_4/metadata/map_converter.h b/modules/camera/3_4/metadata/map_converter.h
index b1734b5..aa11981 100644
--- a/modules/camera/3_4/metadata/map_converter.h
+++ b/modules/camera/3_4/metadata/map_converter.h
@@ -17,12 +17,12 @@
#ifndef V4L2_CAMERA_HAL_METADATA_MAP_CONVERTER_H_
#define V4L2_CAMERA_HAL_METADATA_MAP_CONVERTER_H_
-#include <errno.h>
-
+#include <cerrno>
#include <map>
#include <memory>
-#include "../common.h"
+#include <android-base/macros.h>
+#include "common.h"
#include "converter_interface.h"
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/menu_control_options.h b/modules/camera/3_4/metadata/menu_control_options.h
index c972dc6..cc7f30d 100644
--- a/modules/camera/3_4/metadata/menu_control_options.h
+++ b/modules/camera/3_4/metadata/menu_control_options.h
@@ -17,9 +17,9 @@
#ifndef V4L2_CAMERA_HAL_METADATA_MENU_CONTROL_OPTIONS_H_
#define V4L2_CAMERA_HAL_METADATA_MENU_CONTROL_OPTIONS_H_
-#include <errno.h>
+#include <cerrno>
-#include "../common.h"
+#include "common.h"
#include "control_options_interface.h"
#include "default_option_delegate.h"
diff --git a/modules/camera/3_4/metadata/menu_control_options_test.cpp b/modules/camera/3_4/metadata/menu_control_options_test.cpp
index 1a6ce6e..b8eea74 100644
--- a/modules/camera/3_4/metadata/menu_control_options_test.cpp
+++ b/modules/camera/3_4/metadata/menu_control_options_test.cpp
@@ -21,7 +21,6 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <hardware/camera3.h>
-
#include "default_option_delegate_mock.h"
using testing::Return;
diff --git a/modules/camera/3_4/metadata/metadata.cpp b/modules/camera/3_4/metadata/metadata.cpp
index efc9959..682d78d 100644
--- a/modules/camera/3_4/metadata/metadata.cpp
+++ b/modules/camera/3_4/metadata/metadata.cpp
@@ -14,13 +14,14 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Metadata"
+
#include "metadata.h"
-#include <camera/CameraMetadata.h>
#include <hardware/camera3.h>
-#include "../common.h"
-#include "metadata_common.h"
+#include "common.h"
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/metadata.h b/modules/camera/3_4/metadata/metadata.h
index e2232b5..eb3e035 100644
--- a/modules/camera/3_4/metadata/metadata.h
+++ b/modules/camera/3_4/metadata/metadata.h
@@ -17,12 +17,9 @@
#ifndef V4L2_CAMERA_HAL_METADATA_H_
#define V4L2_CAMERA_HAL_METADATA_H_
-#include <set>
-
+#include <android-base/macros.h>
#include <camera/CameraMetadata.h>
-#include <hardware/camera3.h>
-#include "../common.h"
#include "metadata_common.h"
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/metadata_common.h b/modules/camera/3_4/metadata/metadata_common.h
index 34b7777..f56ccc8 100644
--- a/modules/camera/3_4/metadata/metadata_common.h
+++ b/modules/camera/3_4/metadata/metadata_common.h
@@ -23,8 +23,8 @@
#include <vector>
#include <camera/CameraMetadata.h>
-
#include "array_vector.h"
+#include "common.h"
#include "partial_metadata_interface.h"
namespace v4l2_camera_hal {
@@ -120,32 +120,41 @@
// A helper for other methods in this file.
// Gets the data pointer of a given metadata entry into |*val|.
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <typename T>
+inline void GetDataPointer(camera_metadata_ro_entry_t&, const T**);
+
+template <>
+inline void GetDataPointer<uint8_t>(camera_metadata_ro_entry_t& entry,
const uint8_t** val) {
*val = entry.data.u8;
}
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<int32_t>(camera_metadata_ro_entry_t& entry,
const int32_t** val) {
*val = entry.data.i32;
}
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<float>(camera_metadata_ro_entry_t& entry,
const float** val) {
*val = entry.data.f;
}
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<int64_t>(camera_metadata_ro_entry_t& entry,
const int64_t** val) {
*val = entry.data.i64;
}
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<double>(camera_metadata_ro_entry_t& entry,
const double** val) {
*val = entry.data.d;
}
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<camera_metadata_rational_t>(camera_metadata_ro_entry_t& entry,
const camera_metadata_rational_t** val) {
*val = entry.data.r;
}
@@ -180,7 +189,7 @@
} else if (entry.count != 1) {
HAL_LOGE(
"Error: expected metadata tag %d to contain exactly 1 value "
- "(had %d).",
+ "(had %zu).",
tag,
entry.count);
return -EINVAL;
@@ -211,7 +220,7 @@
} else if (entry.count != N) {
HAL_LOGE(
"Error: expected metadata tag %d to contain a single array of "
- "exactly %d values (had %d).",
+ "exactly %zu values (had %zu).",
tag,
N,
entry.count);
@@ -284,7 +293,7 @@
if (entry.count % N != 0) {
HAL_LOGE(
"Error: expected metadata tag %d to contain a vector of arrays of "
- "length %d (had %d entries, which is not divisible by %d).",
+ "length %zu (had %zu entries, which is not divisible by %zu).",
tag,
N,
entry.count,
diff --git a/modules/camera/3_4/metadata/metadata_reader.cpp b/modules/camera/3_4/metadata/metadata_reader.cpp
index fe2ff85..6a25127 100644
--- a/modules/camera/3_4/metadata/metadata_reader.cpp
+++ b/modules/camera/3_4/metadata/metadata_reader.cpp
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#include "metadata_reader.h"
-
// #define LOG_NDEBUG 0
#define LOG_TAG "MetadataReader"
+
+#include "metadata_reader.h"
+
#include <cutils/log.h>
#include <system/camera.h>
@@ -200,9 +201,9 @@
}
// Must have a non-negative stall.
if (stall.duration < 0) {
- ALOGE("%s: Invalid stall duration: negative stall %d.",
+ ALOGE("%s: Invalid stall duration: negative stall %lld.",
__func__,
- stall.duration);
+ static_cast<long long>(stall.duration));
return -EINVAL;
}
// TODO(b/31384253): YUV_420_888, RAW10, RAW12, RAW_OPAQUE,
diff --git a/modules/camera/3_4/metadata/metadata_reader.h b/modules/camera/3_4/metadata/metadata_reader.h
index 996bf8b..f704a15 100644
--- a/modules/camera/3_4/metadata/metadata_reader.h
+++ b/modules/camera/3_4/metadata/metadata_reader.h
@@ -17,14 +17,12 @@
#ifndef DEFAULT_CAMERA_HAL_METADATA_METADATA_READER_H_
#define DEFAULT_CAMERA_HAL_METADATA_METADATA_READER_H_
-#include <map>
#include <memory>
#include <set>
#include <vector>
+#include <android-base/macros.h>
#include <camera/CameraMetadata.h>
-
-#include "../common.h"
#include "types.h"
namespace default_camera_hal {
diff --git a/modules/camera/3_4/metadata/metadata_reader_mock.h b/modules/camera/3_4/metadata/metadata_reader_mock.h
index 19895a7..3a91d17 100644
--- a/modules/camera/3_4/metadata/metadata_reader_mock.h
+++ b/modules/camera/3_4/metadata/metadata_reader_mock.h
@@ -19,10 +19,10 @@
#ifndef DEFAULT_CAMERA_HAL_METADATA_METADATA_READER_MOCK_H_
#define DEFAULT_CAMERA_HAL_METADATA_METADATA_READER_MOCK_H_
-#include <gmock/gmock.h>
-
#include "metadata_reader.h"
+#include <gmock/gmock.h>
+
namespace default_camera_hal {
class MetadataReaderMock : public MetadataReader {
diff --git a/modules/camera/3_4/metadata/metadata_reader_test.cpp b/modules/camera/3_4/metadata/metadata_reader_test.cpp
index 5b9cc63..92f9438 100644
--- a/modules/camera/3_4/metadata/metadata_reader_test.cpp
+++ b/modules/camera/3_4/metadata/metadata_reader_test.cpp
@@ -17,16 +17,12 @@
#include "metadata_reader.h"
#include <camera/CameraMetadata.h>
-#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <system/camera.h>
#include "array_vector.h"
#include "metadata_common.h"
-using testing::AtMost;
-using testing::Expectation;
-using testing::Return;
using testing::Test;
namespace default_camera_hal {
diff --git a/modules/camera/3_4/metadata/metadata_test.cpp b/modules/camera/3_4/metadata/metadata_test.cpp
index 508884c..5769a76 100644
--- a/modules/camera/3_4/metadata/metadata_test.cpp
+++ b/modules/camera/3_4/metadata/metadata_test.cpp
@@ -23,7 +23,6 @@
#include <camera/CameraMetadata.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-
#include "metadata_common.h"
#include "partial_metadata_interface_mock.h"
diff --git a/modules/camera/3_4/metadata/partial_metadata_factory.h b/modules/camera/3_4/metadata/partial_metadata_factory.h
index 63bf2f5..75aba25 100644
--- a/modules/camera/3_4/metadata/partial_metadata_factory.h
+++ b/modules/camera/3_4/metadata/partial_metadata_factory.h
@@ -17,7 +17,7 @@
#ifndef V4L2_CAMERA_HAL_METADATA_CONTROL_FACTORY_H_
#define V4L2_CAMERA_HAL_METADATA_CONTROL_FACTORY_H_
-#include "../common.h"
+#include "common.h"
#include "control.h"
#include "menu_control_options.h"
#include "no_effect_control_delegate.h"
diff --git a/modules/camera/3_4/metadata/partial_metadata_factory_test.cpp b/modules/camera/3_4/metadata/partial_metadata_factory_test.cpp
index 3537ed2..f039b54 100644
--- a/modules/camera/3_4/metadata/partial_metadata_factory_test.cpp
+++ b/modules/camera/3_4/metadata/partial_metadata_factory_test.cpp
@@ -14,15 +14,16 @@
* limitations under the License.
*/
+#include "partial_metadata_factory.h"
+
#include <camera/CameraMetadata.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include "../v4l2_wrapper_mock.h"
#include "converter_interface_mock.h"
#include "metadata_common.h"
-#include "partial_metadata_factory.h"
#include "test_common.h"
+#include "v4l2_wrapper_mock.h"
using testing::AtMost;
using testing::Expectation;
diff --git a/modules/camera/3_4/metadata/partial_metadata_interface.h b/modules/camera/3_4/metadata/partial_metadata_interface.h
index f6e9138..4212e03 100644
--- a/modules/camera/3_4/metadata/partial_metadata_interface.h
+++ b/modules/camera/3_4/metadata/partial_metadata_interface.h
@@ -17,14 +17,10 @@
#ifndef V4L2_CAMERA_HAL_METADATA_PARTIAL_METADATA_INTERFACE_H_
#define V4L2_CAMERA_HAL_METADATA_PARTIAL_METADATA_INTERFACE_H_
-#include <array>
#include <vector>
#include <camera/CameraMetadata.h>
-#include "../common.h"
-#include "array_vector.h"
-
namespace v4l2_camera_hal {
// A subset of metadata.
diff --git a/modules/camera/3_4/metadata/partial_metadata_interface_mock.h b/modules/camera/3_4/metadata/partial_metadata_interface_mock.h
index 9e822a1..289b978 100644
--- a/modules/camera/3_4/metadata/partial_metadata_interface_mock.h
+++ b/modules/camera/3_4/metadata/partial_metadata_interface_mock.h
@@ -19,10 +19,10 @@
#ifndef V4L2_CAMERA_HAL_PARTIAL_METADATA_INTERFACE_MOCK_H_
#define V4L2_CAMERA_HAL_PARTIAL_METADATA_INTERFACE_MOCK_H_
-#include <gmock/gmock.h>
-
#include "partial_metadata_interface.h"
+#include <gmock/gmock.h>
+
namespace v4l2_camera_hal {
class PartialMetadataInterfaceMock : public PartialMetadataInterface {
diff --git a/modules/camera/3_4/metadata/property.h b/modules/camera/3_4/metadata/property.h
index 6884c7d..b5a996c 100644
--- a/modules/camera/3_4/metadata/property.h
+++ b/modules/camera/3_4/metadata/property.h
@@ -17,7 +17,6 @@
#ifndef V4L2_CAMERA_HAL_METADATA_PROPERTY_H_
#define V4L2_CAMERA_HAL_METADATA_PROPERTY_H_
-#include "../common.h"
#include "metadata_common.h"
#include "partial_metadata_interface.h"
@@ -41,22 +40,22 @@
};
virtual int PopulateDynamicFields(
- android::CameraMetadata* metadata) const override {
+ android::CameraMetadata* /*metadata*/) const override {
return 0;
};
virtual int PopulateTemplateRequest(
- int template_type, android::CameraMetadata* metadata) const override {
+ int /*template_type*/, android::CameraMetadata* /*metadata*/) const override {
return 0;
};
virtual bool SupportsRequestValues(
- const android::CameraMetadata& metadata) const override {
+ const android::CameraMetadata& /*metadata*/) const override {
return true;
};
virtual int SetRequestValues(
- const android::CameraMetadata& metadata) override {
+ const android::CameraMetadata& /*metadata*/) override {
return 0;
};
diff --git a/modules/camera/3_4/metadata/property_test.cpp b/modules/camera/3_4/metadata/property_test.cpp
index 80f8eb8..5faac47 100644
--- a/modules/camera/3_4/metadata/property_test.cpp
+++ b/modules/camera/3_4/metadata/property_test.cpp
@@ -20,19 +20,13 @@
#include <vector>
#include <camera/CameraMetadata.h>
-#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <hardware/camera3.h>
-
#include "array_vector.h"
#include "metadata_common.h"
#include "test_common.h"
-using testing::AtMost;
-using testing::Return;
-using testing::ReturnRef;
using testing::Test;
-using testing::_;
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/ranged_converter.h b/modules/camera/3_4/metadata/ranged_converter.h
index 115ac2a..abfe370 100644
--- a/modules/camera/3_4/metadata/ranged_converter.h
+++ b/modules/camera/3_4/metadata/ranged_converter.h
@@ -19,7 +19,8 @@
#include <memory>
-#include "../common.h"
+#include <android-base/macros.h>
+#include "common.h"
#include "converter_interface.h"
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/scaling_converter.h b/modules/camera/3_4/metadata/scaling_converter.h
index 3087167..bddf1f4 100644
--- a/modules/camera/3_4/metadata/scaling_converter.h
+++ b/modules/camera/3_4/metadata/scaling_converter.h
@@ -17,7 +17,7 @@
#ifndef V4L2_CAMERA_HAL_METADATA_SCALING_CONVERTER_H_
#define V4L2_CAMERA_HAL_METADATA_SCALING_CONVERTER_H_
-#include "../common.h"
+#include "common.h"
#include "converter_interface.h"
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/slider_control_options.h b/modules/camera/3_4/metadata/slider_control_options.h
index 88c1651..1d9fb7e 100644
--- a/modules/camera/3_4/metadata/slider_control_options.h
+++ b/modules/camera/3_4/metadata/slider_control_options.h
@@ -17,11 +17,10 @@
#ifndef V4L2_CAMERA_HAL_METADATA_SLIDER_CONTROL_OPTIONS_H_
#define V4L2_CAMERA_HAL_METADATA_SLIDER_CONTROL_OPTIONS_H_
-#include <errno.h>
-
+#include <cerrno>
#include <vector>
-#include "../common.h"
+#include "common.h"
#include "control_options_interface.h"
#include "default_option_delegate.h"
diff --git a/modules/camera/3_4/metadata/slider_control_options_test.cpp b/modules/camera/3_4/metadata/slider_control_options_test.cpp
index b7cef5a..7f3a643 100644
--- a/modules/camera/3_4/metadata/slider_control_options_test.cpp
+++ b/modules/camera/3_4/metadata/slider_control_options_test.cpp
@@ -21,7 +21,6 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <hardware/camera3.h>
-
#include "default_option_delegate_mock.h"
using testing::Return;
diff --git a/modules/camera/3_4/metadata/state.h b/modules/camera/3_4/metadata/state.h
index 54f66e4..3fd8447 100644
--- a/modules/camera/3_4/metadata/state.h
+++ b/modules/camera/3_4/metadata/state.h
@@ -17,7 +17,7 @@
#ifndef V4L2_CAMERA_HAL_METADATA_STATE_H_
#define V4L2_CAMERA_HAL_METADATA_STATE_H_
-#include "../common.h"
+#include "common.h"
#include "metadata_common.h"
#include "partial_metadata_interface.h"
#include "state_delegate_interface.h"
@@ -54,7 +54,7 @@
// -----------------------------------------------------------------------------
template <typename T>
-int State<T>::PopulateStaticFields(android::CameraMetadata* metadata) const {
+int State<T>::PopulateStaticFields(android::CameraMetadata* /*metadata*/) const {
HAL_LOG_ENTER();
return 0;
}
@@ -72,21 +72,21 @@
};
template <typename T>
-int State<T>::PopulateTemplateRequest(int template_type,
- android::CameraMetadata* metadata) const {
+int State<T>::PopulateTemplateRequest(int /*template_type*/,
+ android::CameraMetadata* /*metadata*/) const {
HAL_LOG_ENTER();
return 0;
};
template <typename T>
bool State<T>::SupportsRequestValues(
- const android::CameraMetadata& metadata) const {
+ const android::CameraMetadata& /*metadata*/) const {
HAL_LOG_ENTER();
return true;
};
template <typename T>
-int State<T>::SetRequestValues(const android::CameraMetadata& metadata) {
+int State<T>::SetRequestValues(const android::CameraMetadata& /*metadata*/) {
HAL_LOG_ENTER();
return 0;
};
diff --git a/modules/camera/3_4/metadata/state_delegate_interface_mock.h b/modules/camera/3_4/metadata/state_delegate_interface_mock.h
index 5064b83..e9698f1 100644
--- a/modules/camera/3_4/metadata/state_delegate_interface_mock.h
+++ b/modules/camera/3_4/metadata/state_delegate_interface_mock.h
@@ -19,10 +19,10 @@
#ifndef V4L2_CAMERA_HAL_METADATA_STATE_DELEGATE_INTERFACE_MOCK_H_
#define V4L2_CAMERA_HAL_METADATA_STATE_DELEGATE_INTERFACE_MOCK_H_
-#include <gmock/gmock.h>
-
#include "state_delegate_interface.h"
+#include <gmock/gmock.h>
+
namespace v4l2_camera_hal {
template <typename T>
diff --git a/modules/camera/3_4/metadata/test_common.h b/modules/camera/3_4/metadata/test_common.h
index 42e44f0..838f97e 100644
--- a/modules/camera/3_4/metadata/test_common.h
+++ b/modules/camera/3_4/metadata/test_common.h
@@ -22,7 +22,6 @@
#include <camera/CameraMetadata.h>
#include <gtest/gtest.h>
-
#include "array_vector.h"
#include "metadata_common.h"
diff --git a/modules/camera/3_4/metadata/v4l2_control_delegate.h b/modules/camera/3_4/metadata/v4l2_control_delegate.h
index 3f45f9c..b52c252 100644
--- a/modules/camera/3_4/metadata/v4l2_control_delegate.h
+++ b/modules/camera/3_4/metadata/v4l2_control_delegate.h
@@ -17,9 +17,9 @@
#ifndef V4L2_CAMERA_HAL_METADATA_V4L2_CONTROL_DELEGATE_H_
#define V4L2_CAMERA_HAL_METADATA_V4L2_CONTROL_DELEGATE_H_
-#include "../v4l2_wrapper.h"
#include "control_delegate_interface.h"
#include "converter_interface.h"
+#include "v4l2_wrapper.h"
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/v4l2_control_delegate_test.cpp b/modules/camera/3_4/metadata/v4l2_control_delegate_test.cpp
index 2f14d6f..63ad0f6 100644
--- a/modules/camera/3_4/metadata/v4l2_control_delegate_test.cpp
+++ b/modules/camera/3_4/metadata/v4l2_control_delegate_test.cpp
@@ -18,9 +18,8 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-
-#include "../v4l2_wrapper_mock.h"
#include "converter_interface_mock.h"
+#include "v4l2_wrapper_mock.h"
using testing::Return;
using testing::SetArgPointee;
diff --git a/modules/camera/3_4/request_tracker.cpp b/modules/camera/3_4/request_tracker.cpp
index 09f634d..f92d254 100644
--- a/modules/camera/3_4/request_tracker.cpp
+++ b/modules/camera/3_4/request_tracker.cpp
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#include "request_tracker.h"
-
// #define LOG_NDEBUG 0
#define LOG_TAG "RequestTracker"
+
+#include "request_tracker.h"
+
#include <cutils/log.h>
namespace default_camera_hal {
@@ -50,7 +51,7 @@
for (const auto& output_buffer : request.output_buffers) {
result.insert(output_buffer.stream);
}
- return std::move(result);
+ return result;
}
bool RequestTracker::Add(std::shared_ptr<CaptureRequest> request) {
@@ -127,7 +128,6 @@
// Check that each stream has space
// (which implicitly checks if it is configured).
- bool result = true;
for (const auto stream : RequestStreams(request)) {
if (StreamFull(stream)) {
ALOGE("%s: Stream %p is full.", __func__, stream);
diff --git a/modules/camera/3_4/request_tracker.h b/modules/camera/3_4/request_tracker.h
index a632a61..3d390e3 100644
--- a/modules/camera/3_4/request_tracker.h
+++ b/modules/camera/3_4/request_tracker.h
@@ -21,10 +21,9 @@
#include <memory>
#include <set>
+#include <android-base/macros.h>
#include <hardware/camera3.h>
-
#include "capture_request.h"
-#include "common.h"
namespace default_camera_hal {
diff --git a/modules/camera/3_4/request_tracker_test.cpp b/modules/camera/3_4/request_tracker_test.cpp
index 8b73bd8..a7e377c 100644
--- a/modules/camera/3_4/request_tracker_test.cpp
+++ b/modules/camera/3_4/request_tracker_test.cpp
@@ -16,15 +16,9 @@
#include "request_tracker.h"
-#include <gmock/gmock.h>
#include <gtest/gtest.h>
-using testing::AtMost;
-using testing::Expectation;
-using testing::Return;
-using testing::SetArgPointee;
using testing::Test;
-using testing::_;
namespace default_camera_hal {
@@ -35,7 +29,11 @@
stream2_.max_buffers = 3;
dut_.reset(new RequestTracker());
streams_ = {&stream1_, &stream2_};
- camera3_stream_configuration_t config{static_cast<uint32_t>(streams_.size()), streams_.data(), 0};
+ camera3_stream_configuration_t config{
+ static_cast<uint32_t>(streams_.size()),
+ streams_.data(),
+ 0,
+ nullptr};
dut_->SetStreamConfiguration(config);
}
diff --git a/modules/camera/3_4/static_properties.cpp b/modules/camera/3_4/static_properties.cpp
index 5be9dcd..0e8ba23 100644
--- a/modules/camera/3_4/static_properties.cpp
+++ b/modules/camera/3_4/static_properties.cpp
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#include "static_properties.h"
-
// #define LOG_NDEBUG 0
#define LOG_TAG "StaticProperties"
+
+#include "static_properties.h"
+
#include <cutils/log.h>
#include <hardware/camera3.h>
#include <system/camera.h>
@@ -276,11 +277,11 @@
for (size_t i = 0; i < stream_config->num_streams; ++i) {
const camera3_stream_t* stream = stream_config->streams[i];
if (stream == nullptr) {
- ALOGE("%s: Stream %d is null", __func__, i);
+ ALOGE("%s: Stream %zu is null", __func__, i);
return false;
} else if (!IsInputType(stream->stream_type) &&
!IsOutputType(stream->stream_type)) {
- ALOGE("%s: Stream %d type %d is neither an input nor an output type",
+ ALOGE("%s: Stream %zu type %d is neither an input nor an output type",
__func__,
i,
stream->stream_type);
@@ -294,7 +295,7 @@
bool StaticProperties::InputStreamsSupported(
const camera3_stream_configuration_t* stream_config) {
// Find the input stream(s).
- size_t num_input_streams = 0;
+ int32_t num_input_streams = 0;
int input_format = -1;
for (size_t i = 0; i < stream_config->num_streams; ++i) {
const camera3_stream_t* stream = stream_config->streams[i];
@@ -370,10 +371,10 @@
bool StaticProperties::OutputStreamsSupported(
const camera3_stream_configuration_t* stream_config) {
// Find and count output streams.
- size_t num_raw = 0;
- size_t num_stalling = 0;
- size_t num_non_stalling = 0;
- for (int i = 0; i < stream_config->num_streams; ++i) {
+ int32_t num_raw = 0;
+ int32_t num_stalling = 0;
+ int32_t num_non_stalling = 0;
+ for (size_t i = 0; i < stream_config->num_streams; ++i) {
const camera3_stream_t* stream = stream_config->streams[i];
if (IsOutputType(stream->stream_type)) {
// Check that this stream is valid as an output.
@@ -413,7 +414,7 @@
} else if (num_stalling > max_stalling_output_streams_) {
ALOGE(
"%s: Requested stream configuration exceeds maximum supported "
- "stalling output streams %d (requested %d).",
+ "stalling output streams %d (requested %u).",
__func__,
max_stalling_output_streams_,
num_stalling);
diff --git a/modules/camera/3_4/static_properties.h b/modules/camera/3_4/static_properties.h
index 25c8205..565118d 100644
--- a/modules/camera/3_4/static_properties.h
+++ b/modules/camera/3_4/static_properties.h
@@ -21,7 +21,6 @@
#include <set>
#include <hardware/camera3.h>
-
#include "common.h"
#include "metadata/metadata_reader.h"
#include "metadata/types.h"
diff --git a/modules/camera/3_4/static_properties_test.cpp b/modules/camera/3_4/static_properties_test.cpp
index 2cdb9d4..13b9e96 100644
--- a/modules/camera/3_4/static_properties_test.cpp
+++ b/modules/camera/3_4/static_properties_test.cpp
@@ -94,10 +94,12 @@
} else if (input) {
type = CAMERA3_STREAM_INPUT;
}
- return {static_cast<int>(type),
- static_cast<uint32_t>(width),
- static_cast<uint32_t>(height),
- static_cast<int>(format)};
+ camera3_stream_t stream;
+ stream.stream_type = type;
+ stream.width = width;
+ stream.height = height;
+ stream.format = format;
+ return stream;
}
void ExpectConfigurationSupported(std::vector<camera3_stream_t>& streams,
@@ -109,7 +111,8 @@
camera3_stream_configuration_t config = {
static_cast<uint32_t>(stream_addresses.size()),
stream_addresses.data(),
- CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
+ CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE,
+ nullptr};
PrepareDefaultDUT();
EXPECT_EQ(dut_->StreamConfigurationSupported(&config), expected);
}
@@ -435,7 +438,7 @@
TEST_F(StaticPropertiesTest, ConfigureEmptyStreams) {
std::vector<camera3_stream_t*> streams(1);
camera3_stream_configuration_t config = {
- 0, streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
+ 0, streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE, nullptr};
PrepareDefaultDUT();
EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
}
@@ -443,7 +446,10 @@
TEST_F(StaticPropertiesTest, ConfigureNullStreams) {
std::vector<camera3_stream_t*> streams(2, nullptr);
camera3_stream_configuration_t config = {
- static_cast<uint32_t>(streams.size()), streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
+ static_cast<uint32_t>(streams.size()),
+ streams.data(),
+ CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE,
+ nullptr};
PrepareDefaultDUT();
EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
}
@@ -451,7 +457,7 @@
TEST_F(StaticPropertiesTest, ConfigureNullStreamVector) {
// Even if the camera claims to have multiple streams, check for null.
camera3_stream_configuration_t config = {
- 3, nullptr, CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
+ 3, nullptr, CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE, nullptr};
PrepareDefaultDUT();
EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
}
@@ -616,7 +622,8 @@
camera3_stream_configuration_t config = {
1,
&stream_address,
- 99 // Not a valid operation mode.
+ 99, // Not a valid operation mode.
+ nullptr
};
PrepareDefaultDUT();
EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
diff --git a/modules/camera/3_4/stream_format.cpp b/modules/camera/3_4/stream_format.cpp
index 5f35e42..4a6231a 100644
--- a/modules/camera/3_4/stream_format.cpp
+++ b/modules/camera/3_4/stream_format.cpp
@@ -14,12 +14,12 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "StreamFormat"
+
#include "stream_format.h"
-#include <linux/videodev2.h>
-
#include <system/graphics.h>
-
#include "arc/image_processor.h"
#include "common.h"
@@ -41,8 +41,7 @@
v4l2_pixel_format_(StreamFormat::HalToV4L2PixelFormat(format)),
width_(width),
height_(height),
- bytes_per_line_(0),
- min_buffer_size_(0) {}
+ bytes_per_line_(0) {}
StreamFormat::StreamFormat(const v4l2_format& format)
: type_(format.type),
@@ -50,16 +49,14 @@
v4l2_pixel_format_(format.fmt.pix.pixelformat),
width_(format.fmt.pix.width),
height_(format.fmt.pix.height),
- bytes_per_line_(format.fmt.pix.bytesperline),
- min_buffer_size_(format.fmt.pix.sizeimage) {}
+ bytes_per_line_(format.fmt.pix.bytesperline) {}
StreamFormat::StreamFormat(const arc::SupportedFormat& format)
: type_(V4L2_BUF_TYPE_VIDEO_CAPTURE),
v4l2_pixel_format_(format.fourcc),
width_(format.width),
height_(format.height),
- bytes_per_line_(0),
- min_buffer_size_(0) {}
+ bytes_per_line_(0) {}
void StreamFormat::FillFormatRequest(v4l2_format* format) const {
memset(format, 0, sizeof(*format));
diff --git a/modules/camera/3_4/stream_format.h b/modules/camera/3_4/stream_format.h
index 720e380..3f0c514 100644
--- a/modules/camera/3_4/stream_format.h
+++ b/modules/camera/3_4/stream_format.h
@@ -17,12 +17,10 @@
#ifndef V4L2_CAMERA_HAL_STREAM_FORMAT_H_
#define V4L2_CAMERA_HAL_STREAM_FORMAT_H_
-#include <string.h>
+#include <cstring>
#include <linux/videodev2.h>
-
#include "arc/common_types.h"
-#include "common.h"
namespace v4l2_camera_hal {
@@ -78,7 +76,6 @@
uint32_t width_;
uint32_t height_;
uint32_t bytes_per_line_;
- uint32_t min_buffer_size_;
};
} // namespace v4l2_camera_hal
diff --git a/modules/camera/3_4/v4l2_camera.cpp b/modules/camera/3_4/v4l2_camera.cpp
index 98b8062..99b7a93 100644
--- a/modules/camera/3_4/v4l2_camera.cpp
+++ b/modules/camera/3_4/v4l2_camera.cpp
@@ -14,18 +14,19 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "V4L2Camera"
+
#include "v4l2_camera.h"
-#include <fcntl.h>
-#include <linux/videodev2.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
#include <cstdlib>
+#include <fcntl.h>
#include <camera/CameraMetadata.h>
#include <hardware/camera3.h>
-
+#include <linux/videodev2.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include "common.h"
#include "function_thread.h"
#include "metadata/metadata_common.h"
@@ -36,18 +37,6 @@
namespace v4l2_camera_hal {
-// Helper function for managing metadata.
-static std::vector<int32_t> getMetadataKeys(const camera_metadata_t* metadata) {
- std::vector<int32_t> keys;
- size_t num_entries = get_camera_metadata_entry_count(metadata);
- for (size_t i = 0; i < num_entries; ++i) {
- camera_metadata_ro_entry_t entry;
- get_camera_metadata_ro_entry(metadata, i, &entry);
- keys.push_back(entry.tag);
- }
- return keys;
-}
-
V4L2Camera* V4L2Camera::NewV4L2Camera(int id, const std::string path) {
HAL_LOG_ENTER();
@@ -73,12 +62,12 @@
: default_camera_hal::Camera(id),
device_(std::move(v4l2_wrapper)),
metadata_(std::move(metadata)),
- max_input_streams_(0),
- max_output_streams_({{0, 0, 0}}),
buffer_enqueuer_(new FunctionThread(
std::bind(&V4L2Camera::enqueueRequestBuffers, this))),
buffer_dequeuer_(new FunctionThread(
- std::bind(&V4L2Camera::dequeueRequestBuffers, this))) {
+ std::bind(&V4L2Camera::dequeueRequestBuffers, this))),
+ max_input_streams_(0),
+ max_output_streams_({{0, 0, 0}}) {
HAL_LOG_ENTER();
}
diff --git a/modules/camera/3_4/v4l2_camera.h b/modules/camera/3_4/v4l2_camera.h
index fc2adb3..ee29145 100644
--- a/modules/camera/3_4/v4l2_camera.h
+++ b/modules/camera/3_4/v4l2_camera.h
@@ -21,14 +21,12 @@
#include <array>
#include <condition_variable>
-#include <map>
#include <queue>
#include <string>
#include <camera/CameraMetadata.h>
#include <utils/StrongPointer.h>
#include <utils/Thread.h>
-
#include "camera.h"
#include "common.h"
#include "metadata/metadata.h"
diff --git a/modules/camera/3_4/v4l2_camera_hal.cpp b/modules/camera/3_4/v4l2_camera_hal.cpp
index 83746ce..17fac1a 100644
--- a/modules/camera/3_4/v4l2_camera_hal.cpp
+++ b/modules/camera/3_4/v4l2_camera_hal.cpp
@@ -16,6 +16,9 @@
// Modified from hardware/libhardware/modules/camera/CameraHAL.cpp
+//#define LOG_NDEBUG 0
+#define LOG_TAG "V4L2CameraHAL"
+
#include "v4l2_camera_hal.h"
#include <dirent.h>
@@ -112,13 +115,13 @@
}
int V4L2CameraHAL::getNumberOfCameras() {
- HAL_LOGV("returns %d", mCameras.size());
+ HAL_LOGV("returns %zu", mCameras.size());
return mCameras.size();
}
int V4L2CameraHAL::getCameraInfo(int id, camera_info_t* info) {
HAL_LOG_ENTER();
- if (id < 0 || id >= mCameras.size()) {
+ if (id < 0 || static_cast<size_t>(id) >= mCameras.size()) {
return -EINVAL;
}
// TODO(b/29185945): Hotplugging: return -EINVAL if unplugged.
@@ -131,22 +134,22 @@
return 0;
}
-void V4L2CameraHAL::getVendorTagOps(vendor_tag_ops_t* ops) {
+void V4L2CameraHAL::getVendorTagOps(vendor_tag_ops_t* /*ops*/) {
HAL_LOG_ENTER();
// No vendor ops for this HAL. From <hardware/camera_common.h>:
// "leave ops unchanged if no vendor tags are defined."
}
-int V4L2CameraHAL::openLegacy(const hw_module_t* module,
- const char* id,
- uint32_t halVersion,
- hw_device_t** device) {
+int V4L2CameraHAL::openLegacy(const hw_module_t* /*module*/,
+ const char* /*id*/,
+ uint32_t /*halVersion*/,
+ hw_device_t** /*device*/) {
HAL_LOG_ENTER();
// Not supported.
return -ENOSYS;
}
-int V4L2CameraHAL::setTorchMode(const char* camera_id, bool enabled) {
+int V4L2CameraHAL::setTorchMode(const char* /*camera_id*/, bool /*enabled*/) {
HAL_LOG_ENTER();
// TODO(b/29158098): HAL is required to respond appropriately if
// the desired camera actually does support flash.
@@ -235,4 +238,5 @@
.open_legacy = v4l2_camera_hal::open_legacy,
.set_torch_mode = v4l2_camera_hal::set_torch_mode,
.init = nullptr,
- .reserved = {nullptr, nullptr, nullptr, nullptr, nullptr}};
+ .get_physical_camera_info = nullptr,
+ .reserved = {nullptr, nullptr}};
diff --git a/modules/camera/3_4/v4l2_metadata_factory.cpp b/modules/camera/3_4/v4l2_metadata_factory.cpp
index bc8806f..096951f 100644
--- a/modules/camera/3_4/v4l2_metadata_factory.cpp
+++ b/modules/camera/3_4/v4l2_metadata_factory.cpp
@@ -14,16 +14,17 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "V4L2MetadataFactory"
+
#include "v4l2_metadata_factory.h"
#include <camera/CameraMetadata.h>
-
#include "common.h"
#include "format_metadata_factory.h"
#include "metadata/boottime_state_delegate.h"
#include "metadata/control.h"
#include "metadata/enum_converter.h"
-#include "metadata/metadata_common.h"
#include "metadata/partial_metadata_factory.h"
#include "metadata/property.h"
#include "metadata/scaling_converter.h"
diff --git a/modules/camera/3_4/v4l2_wrapper.cpp b/modules/camera/3_4/v4l2_wrapper.cpp
index d715e7e..bee7855 100644
--- a/modules/camera/3_4/v4l2_wrapper.cpp
+++ b/modules/camera/3_4/v4l2_wrapper.cpp
@@ -14,21 +14,19 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "V4L2Wrapper"
+
#include "v4l2_wrapper.h"
#include <algorithm>
-#include <array>
-#include <limits>
-#include <mutex>
-#include <vector>
-
#include <fcntl.h>
+#include <limits>
+
+#include <android-base/unique_fd.h>
#include <linux/videodev2.h>
#include <sys/stat.h>
#include <sys/types.h>
-
-#include <android-base/unique_fd.h>
-
#include "arc/cached_frame.h"
namespace v4l2_camera_hal {
@@ -126,7 +124,7 @@
// Helper function. Should be used instead of ioctl throughout this class.
template <typename T>
-int V4L2Wrapper::IoctlLocked(int request, T data) {
+int V4L2Wrapper::IoctlLocked(unsigned long request, T data) {
// Potentially called so many times logging entry is a bad idea.
std::lock_guard<std::mutex> lock(device_lock_);
diff --git a/modules/camera/3_4/v4l2_wrapper.h b/modules/camera/3_4/v4l2_wrapper.h
index 4a8d517..2682ce7 100644
--- a/modules/camera/3_4/v4l2_wrapper.h
+++ b/modules/camera/3_4/v4l2_wrapper.h
@@ -25,7 +25,6 @@
#include <vector>
#include <android-base/unique_fd.h>
-
#include "arc/common_types.h"
#include "arc/frame_buffer.h"
#include "capture_request.h"
@@ -99,7 +98,7 @@
void Disconnect();
// Perform an ioctl call in a thread-safe fashion.
template <typename T>
- int IoctlLocked(int request, T data);
+ int IoctlLocked(unsigned long request, T data);
// Request/release userspace buffer mode via VIDIOC_REQBUFS.
int RequestBuffers(uint32_t num_buffers);
diff --git a/modules/camera/3_4/v4l2_wrapper_mock.h b/modules/camera/3_4/v4l2_wrapper_mock.h
index f98bc94..1e4d3ad 100644
--- a/modules/camera/3_4/v4l2_wrapper_mock.h
+++ b/modules/camera/3_4/v4l2_wrapper_mock.h
@@ -19,10 +19,10 @@
#ifndef V4L2_CAMERA_HAL_V4L2_WRAPPER_MOCK_H_
#define V4L2_CAMERA_HAL_V4L2_WRAPPER_MOCK_H_
-#include <gmock/gmock.h>
-
#include "v4l2_wrapper.h"
+#include <gmock/gmock.h>
+
namespace v4l2_camera_hal {
class V4L2WrapperMock : public V4L2Wrapper {
diff --git a/modules/input/evdev/InputHub.cpp b/modules/input/evdev/InputHub.cpp
index af7b28e..d22fc88 100644
--- a/modules/input/evdev/InputHub.cpp
+++ b/modules/input/evdev/InputHub.cpp
@@ -495,7 +495,7 @@
status_t InputHub::unregisterDevicePath(const std::string& path) {
int wd = -1;
- for (auto pair : mWatchedPaths) {
+ for (const auto& pair : mWatchedPaths) {
if (pair.second == path) {
wd = pair.first;
break;
@@ -781,7 +781,7 @@
}
status_t InputHub::closeNode(const InputDeviceNode* node) {
- for (auto pair : mDeviceNodes) {
+ for (const auto& pair : mDeviceNodes) {
if (pair.second.get() == node) {
return closeNodeByFd(pair.first);
}
@@ -801,7 +801,7 @@
}
std::shared_ptr<InputDeviceNode> InputHub::findNodeByPath(const std::string& path) {
- for (auto pair : mDeviceNodes) {
+ for (const auto& pair : mDeviceNodes) {
if (pair.second->getPath() == path) return pair.second;
}
return nullptr;
diff --git a/modules/sensors/OWNERS b/modules/sensors/OWNERS
index d4393d6..81099e8 100644
--- a/modules/sensors/OWNERS
+++ b/modules/sensors/OWNERS
@@ -1,2 +1,3 @@
arthuri@google.com
bduddie@google.com
+bstack@google.com
diff --git a/modules/sensors/dynamic_sensor/Android.bp b/modules/sensors/dynamic_sensor/Android.bp
index 214d97c..489cdf4 100644
--- a/modules/sensors/dynamic_sensor/Android.bp
+++ b/modules/sensors/dynamic_sensor/Android.bp
@@ -22,6 +22,8 @@
"-Wall",
"-Werror",
"-Wextra",
+ // Allow implicit fallthroughs in HidRawSensor.cpp until they are fixed.
+ "-Wno-error=implicit-fallthrough",
],
export_include_dirs: ["."],
diff --git a/modules/sensors/dynamic_sensor/HidRawSensor.cpp b/modules/sensors/dynamic_sensor/HidRawSensor.cpp
index b5dc80a..4668412 100644
--- a/modules/sensors/dynamic_sensor/HidRawSensor.cpp
+++ b/modules/sensors/dynamic_sensor/HidRawSensor.cpp
@@ -35,7 +35,7 @@
HidRawSensor::HidRawSensor(
SP(HidDevice) device, uint32_t usage, const std::vector<HidParser::ReportPacket> &packets)
: mReportingStateId(-1), mPowerStateId(-1), mReportIntervalId(-1), mInputReportId(-1),
- mEnabled(false), mSamplingPeriod(1000ll*1000*1000), mBatchingPeriod(0),
+ mEnabled(false), mSamplingPeriod(1000LL*1000*1000), mBatchingPeriod(0),
mDevice(device), mValid(false) {
if (device == nullptr) {
return;
diff --git a/modules/sensors/multihal.cpp b/modules/sensors/multihal.cpp
index a1f0104..f41d72f 100644
--- a/modules/sensors/multihal.cpp
+++ b/modules/sensors/multihal.cpp
@@ -18,7 +18,7 @@
#include "multihal.h"
#define LOG_NDEBUG 1
-#include <cutils/log.h>
+#include <log/log.h>
#include <cutils/atomic.h>
#include <hardware/sensors.h>
diff --git a/modules/soundtrigger/sound_trigger_hw.c b/modules/soundtrigger/sound_trigger_hw.c
index 0089f98..38212c4 100644
--- a/modules/soundtrigger/sound_trigger_hw.c
+++ b/modules/soundtrigger/sound_trigger_hw.c
@@ -811,6 +811,41 @@
return 0;
}
+static int stdev_get_model_state(const struct sound_trigger_hw_device *dev,
+ sound_model_handle_t handle) {
+ int ret = 0;
+ struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev;
+ ALOGI("%s", __func__);
+ pthread_mutex_lock(&stdev->lock);
+
+ struct recognition_context *model_context = get_model_context(stdev, handle);
+ if (!model_context) {
+ ALOGW("Can't find sound model handle %d in registered list", handle);
+ ret = -ENOSYS;
+ goto exit;
+ }
+
+ if (!model_context->model_started) {
+ ALOGW("Sound model %d not started", handle);
+ ret = -ENOSYS;
+ goto exit;
+ }
+
+ if (model_context->recognition_callback == NULL) {
+ ALOGW("Sound model %d not initialized", handle);
+ ret = -ENOSYS;
+ goto exit;
+ }
+
+ // TODO(mdooley): trigger recognition event
+
+exit:
+ pthread_mutex_unlock(&stdev->lock);
+ ALOGI("%s done for handle %d", __func__, handle);
+
+ return ret;
+}
+
__attribute__ ((visibility ("default")))
int sound_trigger_open_for_streaming() {
int ret = 0;
@@ -863,6 +898,7 @@
stdev->device.start_recognition = stdev_start_recognition;
stdev->device.stop_recognition = stdev_stop_recognition;
stdev->device.stop_all_recognitions = stdev_stop_all_recognitions;
+ stdev->device.get_model_state = stdev_get_model_state;
pthread_mutex_init(&stdev->lock, (const pthread_mutexattr_t *) NULL);
@@ -890,4 +926,3 @@
.methods = &hal_module_methods,
},
};
-
diff --git a/modules/usbaudio/audio_hal.c b/modules/usbaudio/audio_hal.c
index 81c9fd6..f0ea015 100644
--- a/modules/usbaudio/audio_hal.c
+++ b/modules/usbaudio/audio_hal.c
@@ -15,7 +15,7 @@
*/
#define LOG_TAG "modules.usbaudio.audio_hal"
-/*#define LOG_NDEBUG 0*/
+/* #define LOG_NDEBUG 0 */
#include <errno.h>
#include <inttypes.h>
@@ -47,27 +47,26 @@
/* Lock play & record samples rates at or above this threshold */
#define RATELOCK_THRESHOLD 96000
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#define min(a, b) ((a) < (b) ? (a) : (b))
+
struct audio_device {
struct audio_hw_device hw_device;
pthread_mutex_t lock; /* see note below on mutex acquisition order */
/* output */
- alsa_device_profile out_profile;
struct listnode output_stream_list;
/* input */
- alsa_device_profile in_profile;
struct listnode input_stream_list;
/* lock input & output sample rates */
/*FIXME - How do we address multiple output streams? */
- uint32_t device_sample_rate;
+ uint32_t device_sample_rate; // this should be a rate that is common to both input & output
bool mic_muted;
- bool standby;
-
int32_t inputs_open; /* number of input streams currently open. */
};
@@ -79,16 +78,13 @@
struct stream_out {
struct audio_stream_out stream;
- struct stream_lock lock;
+ struct stream_lock lock;
bool standby;
struct audio_device *adev; /* hardware information - only using this for the lock */
- const alsa_device_profile *profile; /* Points to the alsa_device_profile in the audio_device.
- * Const, so modifications go through adev->out_profile
- * and thus should have the hardware lock and ensure
- * stream is not active and no other open output streams.
+ alsa_device_profile profile; /* The profile of the ALSA device connected to the stream.
*/
alsa_device_proxy proxy; /* state of the stream */
@@ -121,10 +117,7 @@
struct audio_device *adev; /* hardware information - only using this for the lock */
- const alsa_device_profile *profile; /* Points to the alsa_device_profile in the audio_device.
- * Const, so modifications go through adev->out_profile
- * and thus should have the hardware lock and ensure
- * stream is not active and no other open input streams.
+ alsa_device_profile profile; /* The profile of the ALSA device connected to the stream.
*/
alsa_device_proxy proxy; /* state of the stream */
@@ -344,9 +337,7 @@
stream_lock(&out->lock);
if (!out->standby) {
- device_lock(out->adev);
proxy_close(&out->proxy);
- device_unlock(out->adev);
out->standby = true;
}
stream_unlock(&out->lock);
@@ -358,7 +349,7 @@
if (out_stream != NULL) {
dprintf(fd, "Output Profile:\n");
- profile_dump(out_stream->profile, fd);
+ profile_dump(&out_stream->profile, fd);
dprintf(fd, "Output Proxy:\n");
proxy_dump(&out_stream->proxy, fd);
@@ -383,27 +374,23 @@
}
stream_lock(&out->lock);
- /* Lock the device because that is where the profile lives */
- device_lock(out->adev);
-
- if (!profile_is_cached_for(out->profile, card, device)) {
+ if (!profile_is_cached_for(&out->profile, card, device)) {
/* cannot read pcm device info if playback is active */
if (!out->standby)
ret_value = -ENOSYS;
else {
- int saved_card = out->profile->card;
- int saved_device = out->profile->device;
- out->adev->out_profile.card = card;
- out->adev->out_profile.device = device;
- ret_value = profile_read_device_info(&out->adev->out_profile) ? 0 : -EINVAL;
+ int saved_card = out->profile.card;
+ int saved_device = out->profile.device;
+ out->profile.card = card;
+ out->profile.device = device;
+ ret_value = profile_read_device_info(&out->profile) ? 0 : -EINVAL;
if (ret_value != 0) {
- out->adev->out_profile.card = saved_card;
- out->adev->out_profile.device = saved_device;
+ out->profile.card = saved_card;
+ out->profile.device = saved_device;
}
}
}
- device_unlock(out->adev);
stream_unlock(&out->lock);
return ret_value;
@@ -413,11 +400,7 @@
{
struct stream_out *out = (struct stream_out *)stream;
stream_lock(&out->lock);
- device_lock(out->adev);
-
- char * params_str = device_get_parameters(out->profile, keys);
-
- device_unlock(out->adev);
+ char * params_str = device_get_parameters(&out->profile, keys);
stream_unlock(&out->lock);
return params_str;
}
@@ -436,7 +419,7 @@
/* must be called with hw device and output stream mutexes locked */
static int start_output_stream(struct stream_out *out)
{
- ALOGV("start_output_stream(card:%d device:%d)", out->profile->card, out->profile->device);
+ ALOGV("start_output_stream(card:%d device:%d)", out->profile.card, out->profile.device);
return proxy_open(&out->proxy);
}
@@ -448,9 +431,7 @@
stream_lock(&out->lock);
if (out->standby) {
- device_lock(out->adev);
ret = start_output_stream(out);
- device_unlock(out->adev);
if (ret != 0) {
goto err;
}
@@ -573,43 +554,45 @@
stream_lock_init(&out->lock);
out->adev = (struct audio_device *)hw_dev;
- device_lock(out->adev);
- out->profile = &out->adev->out_profile;
+
+ profile_init(&out->profile, PCM_OUT);
// build this to hand to the alsa_device_proxy
struct pcm_config proxy_config;
memset(&proxy_config, 0, sizeof(proxy_config));
/* Pull out the card/device pair */
- parse_card_device_params(address, &out->adev->out_profile.card, &out->adev->out_profile.device);
+ parse_card_device_params(address, &out->profile.card, &out->profile.device);
- profile_read_device_info(&out->adev->out_profile);
+ profile_read_device_info(&out->profile);
int ret = 0;
/* Rate */
if (config->sample_rate == 0) {
- proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(out->profile);
- } else if (profile_is_sample_rate_valid(out->profile, config->sample_rate)) {
+ proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(&out->profile);
+ } else if (profile_is_sample_rate_valid(&out->profile, config->sample_rate)) {
proxy_config.rate = config->sample_rate;
} else {
- proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(out->profile);
+ proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(&out->profile);
ret = -EINVAL;
}
+ /* TODO: This is a problem if the input does not support this rate */
+ device_lock(out->adev);
out->adev->device_sample_rate = config->sample_rate;
device_unlock(out->adev);
/* Format */
if (config->format == AUDIO_FORMAT_DEFAULT) {
- proxy_config.format = profile_get_default_format(out->profile);
+ proxy_config.format = profile_get_default_format(&out->profile);
config->format = audio_format_from_pcm_format(proxy_config.format);
} else {
enum pcm_format fmt = pcm_format_from_audio_format(config->format);
- if (profile_is_format_valid(out->profile, fmt)) {
+ if (profile_is_format_valid(&out->profile, fmt)) {
proxy_config.format = fmt;
} else {
- proxy_config.format = profile_get_default_format(out->profile);
+ proxy_config.format = profile_get_default_format(&out->profile);
config->format = audio_format_from_pcm_format(proxy_config.format);
ret = -EINVAL;
}
@@ -619,7 +602,7 @@
bool calc_mask = false;
if (config->channel_mask == AUDIO_CHANNEL_NONE) {
/* query case */
- out->hal_channel_count = profile_get_default_channel_count(out->profile);
+ out->hal_channel_count = profile_get_default_channel_count(&out->profile);
calc_mask = true;
} else {
/* explicit case */
@@ -647,8 +630,9 @@
// Validate the "logical" channel count against support in the "actual" profile.
// if they differ, choose the "actual" number of channels *closest* to the "logical".
// and store THAT in proxy_config.channels
- proxy_config.channels = profile_get_closest_channel_count(out->profile, out->hal_channel_count);
- proxy_prepare(&out->proxy, out->profile, &proxy_config);
+ proxy_config.channels =
+ profile_get_closest_channel_count(&out->profile, out->hal_channel_count);
+ proxy_prepare(&out->proxy, &out->profile, &proxy_config);
/* TODO The retry mechanism isn't implemented in AudioPolicyManager/AudioFlinger
* So clear any errors that may have occurred above.
@@ -672,9 +656,7 @@
struct audio_stream_out *stream)
{
struct stream_out *out = (struct stream_out *)stream;
- ALOGV("adev_close_output_stream(c:%d d:%d)", out->profile->card, out->profile->device);
-
- adev_remove_stream_from_list(out->adev, &out->list_node);
+ ALOGV("adev_close_output_stream(c:%d d:%d)", out->profile.card, out->profile.device);
/* Close the pcm device */
out_standby(&stream->common);
@@ -684,6 +666,8 @@
out->conversion_buffer = NULL;
out->conversion_buffer_size = 0;
+ adev_remove_stream_from_list(out->adev, &out->list_node);
+
device_lock(out->adev);
out->adev->device_sample_rate = 0;
device_unlock(out->adev);
@@ -746,12 +730,9 @@
stream_lock(&in->lock);
if (!in->standby) {
- device_lock(in->adev);
proxy_close(&in->proxy);
- device_unlock(in->adev);
in->standby = true;
}
-
stream_unlock(&in->lock);
return 0;
@@ -762,7 +743,7 @@
const struct stream_in* in_stream = (const struct stream_in*)stream;
if (in_stream != NULL) {
dprintf(fd, "Input Profile:\n");
- profile_dump(in_stream->profile, fd);
+ profile_dump(&in_stream->profile, fd);
dprintf(fd, "Input Proxy:\n");
proxy_dump(&in_stream->proxy, fd);
@@ -789,19 +770,20 @@
stream_lock(&in->lock);
device_lock(in->adev);
- if (card >= 0 && device >= 0 && !profile_is_cached_for(in->profile, card, device)) {
- /* cannot read pcm device info if playback is active, or more than one open stream */
+ if (card >= 0 && device >= 0 && !profile_is_cached_for(&in->profile, card, device)) {
+ /* cannot read pcm device info if capture is active, or more than one open stream */
if (!in->standby || in->adev->inputs_open > 1)
ret_value = -ENOSYS;
else {
- int saved_card = in->profile->card;
- int saved_device = in->profile->device;
- in->adev->in_profile.card = card;
- in->adev->in_profile.device = device;
- ret_value = profile_read_device_info(&in->adev->in_profile) ? 0 : -EINVAL;
+ int saved_card = in->profile.card;
+ int saved_device = in->profile.device;
+ in->profile.card = card;
+ in->profile.device = device;
+ ret_value = profile_read_device_info(&in->profile) ? 0 : -EINVAL;
if (ret_value != 0) {
- in->adev->in_profile.card = saved_card;
- in->adev->in_profile.device = saved_device;
+ ALOGE("Can't read device profile. card:%d, device:%d", card, device);
+ in->profile.card = saved_card;
+ in->profile.device = saved_device;
}
}
}
@@ -817,11 +799,7 @@
struct stream_in *in = (struct stream_in *)stream;
stream_lock(&in->lock);
- device_lock(in->adev);
-
- char * params_str = device_get_parameters(in->profile, keys);
-
- device_unlock(in->adev);
+ char * params_str = device_get_parameters(&in->profile, keys);
stream_unlock(&in->lock);
return params_str;
@@ -845,7 +823,7 @@
/* must be called with hw device and output stream mutexes locked */
static int start_input_stream(struct stream_in *in)
{
- ALOGV("start_input_stream(card:%d device:%d)", in->profile->card, in->profile->device);
+ ALOGV("start_input_stream(card:%d device:%d)", in->profile.card, in->profile.device);
return proxy_open(&in->proxy);
}
@@ -862,9 +840,7 @@
stream_lock(&in->lock);
if (in->standby) {
- device_lock(in->adev);
ret = start_input_stream(in);
- device_unlock(in->adev);
if (ret != 0) {
goto err;
}
@@ -929,6 +905,43 @@
return 0;
}
+static int in_get_capture_position(const struct audio_stream_in *stream,
+ int64_t *frames, int64_t *time)
+{
+ struct stream_in *in = (struct stream_in *)stream; // discard const qualifier
+ stream_lock(&in->lock);
+
+ const alsa_device_proxy *proxy = &in->proxy;
+ const int ret = proxy_get_capture_position(proxy, frames, time);
+
+ stream_unlock(&in->lock);
+ return ret;
+}
+
+static int in_get_active_microphones(const struct audio_stream_in *stream,
+ struct audio_microphone_characteristic_t *mic_array,
+ size_t *mic_count) {
+ (void)stream;
+ (void)mic_array;
+ (void)mic_count;
+
+ return -ENOSYS;
+}
+
+static int in_set_microphone_direction(const struct audio_stream_in *stream,
+ audio_microphone_direction_t dir) {
+ (void)stream;
+ (void)dir;
+ ALOGV("---- in_set_microphone_direction()");
+ return -ENOSYS;
+}
+
+static int in_set_microphone_field_dimension(const struct audio_stream_in *stream, float zoom) {
+ (void)zoom;
+ ALOGV("---- in_set_microphone_field_dimension()");
+ return -ENOSYS;
+}
+
static int adev_open_input_stream(struct audio_hw_device *hw_dev,
audio_io_handle_t handle,
audio_devices_t devicesSpec __unused,
@@ -972,68 +985,89 @@
in->stream.set_gain = in_set_gain;
in->stream.read = in_read;
in->stream.get_input_frames_lost = in_get_input_frames_lost;
+ in->stream.get_capture_position = in_get_capture_position;
+
+ in->stream.get_active_microphones = in_get_active_microphones;
+ in->stream.set_microphone_direction = in_set_microphone_direction;
+ in->stream.set_microphone_field_dimension = in_set_microphone_field_dimension;
stream_lock_init(&in->lock);
in->adev = (struct audio_device *)hw_dev;
- device_lock(in->adev);
- in->profile = &in->adev->in_profile;
+ profile_init(&in->profile, PCM_IN);
struct pcm_config proxy_config;
memset(&proxy_config, 0, sizeof(proxy_config));
int ret = 0;
+ device_lock(in->adev);
+ int num_open_inputs = in->adev->inputs_open;
+ device_unlock(in->adev);
+
/* Check if an input stream is already open */
- if (in->adev->inputs_open > 0) {
- if (!profile_is_cached_for(in->profile, card, device)) {
+ if (num_open_inputs > 0) {
+ if (!profile_is_cached_for(&in->profile, card, device)) {
ALOGW("%s fail - address card:%d device:%d doesn't match existing profile",
__func__, card, device);
ret = -EINVAL;
}
} else {
/* Read input profile only if necessary */
- in->adev->in_profile.card = card;
- in->adev->in_profile.device = device;
- if (!profile_read_device_info(&in->adev->in_profile)) {
+ in->profile.card = card;
+ in->profile.device = device;
+ if (!profile_read_device_info(&in->profile)) {
ALOGW("%s fail - cannot read profile", __func__);
ret = -EINVAL;
}
}
if (ret != 0) {
- device_unlock(in->adev);
free(in);
*stream_in = NULL;
return ret;
}
/* Rate */
+ int request_config_rate = config->sample_rate;
if (config->sample_rate == 0) {
- config->sample_rate = profile_get_default_sample_rate(in->profile);
+ config->sample_rate = profile_get_default_sample_rate(&in->profile);
}
- if (in->adev->device_sample_rate != 0 && /* we are playing, so lock the rate */
+ if (in->adev->device_sample_rate != 0 && /* we are playing, so lock the rate if possible */
in->adev->device_sample_rate >= RATELOCK_THRESHOLD) {/* but only for high sample rates */
- ret = config->sample_rate != in->adev->device_sample_rate ? -EINVAL : 0;
- proxy_config.rate = config->sample_rate = in->adev->device_sample_rate;
- } else if (profile_is_sample_rate_valid(in->profile, config->sample_rate)) {
+ if (config->sample_rate != in->adev->device_sample_rate) {
+ unsigned highest_rate = profile_get_highest_sample_rate(&in->profile);
+ if (highest_rate == 0) {
+ ret = -EINVAL; /* error with device */
+ } else {
+ proxy_config.rate = config->sample_rate =
+ min(highest_rate, in->adev->device_sample_rate);
+ if (request_config_rate != 0 && proxy_config.rate != config->sample_rate) {
+ /* Changing the requested rate */
+ ret = -EINVAL;
+ } else {
+ /* Everything AOK! */
+ ret = 0;
+ }
+ }
+ }
+ } else if (profile_is_sample_rate_valid(&in->profile, config->sample_rate)) {
proxy_config.rate = config->sample_rate;
} else {
- proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(in->profile);
+ proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(&in->profile);
ret = -EINVAL;
}
- device_unlock(in->adev);
/* Format */
if (config->format == AUDIO_FORMAT_DEFAULT) {
- proxy_config.format = profile_get_default_format(in->profile);
+ proxy_config.format = profile_get_default_format(&in->profile);
config->format = audio_format_from_pcm_format(proxy_config.format);
} else {
enum pcm_format fmt = pcm_format_from_audio_format(config->format);
- if (profile_is_format_valid(in->profile, fmt)) {
+ if (profile_is_format_valid(&in->profile, fmt)) {
proxy_config.format = fmt;
} else {
- proxy_config.format = profile_get_default_format(in->profile);
+ proxy_config.format = profile_get_default_format(&in->profile);
config->format = audio_format_from_pcm_format(proxy_config.format);
ret = -EINVAL;
}
@@ -1043,7 +1077,7 @@
bool calc_mask = false;
if (config->channel_mask == AUDIO_CHANNEL_NONE) {
/* query case */
- in->hal_channel_count = profile_get_default_channel_count(in->profile);
+ in->hal_channel_count = profile_get_default_channel_count(&in->profile);
calc_mask = true;
} else {
/* explicit case */
@@ -1080,8 +1114,8 @@
// if they differ, choose the "actual" number of channels *closest* to the "logical".
// and store THAT in proxy_config.channels
proxy_config.channels =
- profile_get_closest_channel_count(in->profile, in->hal_channel_count);
- ret = proxy_prepare(&in->proxy, in->profile, &proxy_config);
+ profile_get_closest_channel_count(&in->profile, in->hal_channel_count);
+ ret = proxy_prepare(&in->proxy, &in->profile, &proxy_config);
if (ret == 0) {
in->standby = true;
@@ -1121,7 +1155,7 @@
struct audio_stream_in *stream)
{
struct stream_in *in = (struct stream_in *)stream;
- ALOGV("adev_close_input_stream(c:%d d:%d)", in->profile->card, in->profile->device);
+ ALOGV("adev_close_input_stream(c:%d d:%d)", in->profile.card, in->profile.device);
adev_remove_stream_from_list(in->adev, &in->list_node);
@@ -1249,8 +1283,7 @@
if (!adev)
return -ENOMEM;
- profile_init(&adev->out_profile, PCM_OUT);
- profile_init(&adev->in_profile, PCM_IN);
+ pthread_mutex_init(&adev->lock, (const pthread_mutexattr_t *) NULL);
list_init(&adev->output_stream_list);
list_init(&adev->input_stream_list);
diff --git a/tests/hardware/struct-offset.cpp b/tests/hardware/struct-offset.cpp
index 6f86f03..82411ad 100644
--- a/tests/hardware/struct-offset.cpp
+++ b/tests/hardware/struct-offset.cpp
@@ -185,7 +185,9 @@
CHECK_MEMBER_AT(gralloc_module_t, lockAsync, 152, 296);
CHECK_MEMBER_AT(gralloc_module_t, unlockAsync, 156, 304);
CHECK_MEMBER_AT(gralloc_module_t, lockAsync_ycbcr, 160, 312);
- CHECK_MEMBER_AT(gralloc_module_t, reserved_proc, 164, 320);
+ CHECK_MEMBER_AT(gralloc_module_t, getTransportSize, 164, 320);
+ CHECK_MEMBER_AT(gralloc_module_t, validateBufferSize, 168, 328);
+ CHECK_MEMBER_AT(gralloc_module_t, reserved_proc, 172, 336);
CHECK_MEMBER_AT(alloc_device_t, common, 0, 0);
CHECK_MEMBER_AT(alloc_device_t, alloc, 64, 120);
@@ -216,7 +218,10 @@
CHECK_MEMBER_AT(camera_module_t, open_legacy, 144, 280);
CHECK_MEMBER_AT(camera_module_t, set_torch_mode, 148, 288);
CHECK_MEMBER_AT(camera_module_t, init, 152, 296);
- CHECK_MEMBER_AT(camera_module_t, reserved, 156, 304);
+ CHECK_MEMBER_AT(camera_module_t, get_physical_camera_info, 156, 304);
+ CHECK_MEMBER_AT(camera_module_t, is_stream_combination_supported, 160, 312);
+ CHECK_MEMBER_AT(camera_module_t, notify_device_state_change, 164, 320);
+ CHECK_MEMBER_AT(camera_module_t, reserved, 168, 328);
//Types defined in camera3.h
CHECK_MEMBER_AT(camera3_device_ops_t, initialize, 0, 0);
@@ -227,6 +232,7 @@
CHECK_MEMBER_AT(camera3_device_ops_t, get_metadata_vendor_tag_ops, 20, 40);
CHECK_MEMBER_AT(camera3_device_ops_t, dump, 24, 48);
CHECK_MEMBER_AT(camera3_device_ops_t, flush, 28, 56);
- CHECK_MEMBER_AT(camera3_device_ops_t, reserved, 32, 64);
+ CHECK_MEMBER_AT(camera3_device_ops_t, signal_stream_flush, 32, 64);
+ CHECK_MEMBER_AT(camera3_device_ops_t, is_reconfiguration_required, 36, 72);
+ CHECK_MEMBER_AT(camera3_device_ops_t, reserved, 40, 80);
}
-