Merge "USB HAL Capture Implementation"
diff --git a/include/hardware/fingerprint.h b/include/hardware/fingerprint.h
index be2f9e2..a5b18fd 100644
--- a/include/hardware/fingerprint.h
+++ b/include/hardware/fingerprint.h
@@ -20,63 +20,98 @@
#define FINGERPRINT_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0)
#define FINGERPRINT_HARDWARE_MODULE_ID "fingerprint"
-typedef enum fingerprint_msg {
+typedef enum fingerprint_msg_type {
FINGERPRINT_ERROR = -1,
- FINGERPRINT_NO_MATCH = 0,
- FINGERPRINT_MATCH = 1,
+ FINGERPRINT_SCANNED = 1,
FINGERPRINT_TEMPLATE_COLLECTING = 2,
- FINGERPRINT_TEMPLATE_REGISTERED = 3,
FINGERPRINT_TEMPLATE_DELETED = 4
-} fingerprint_msg_t;
+} fingerprint_msg_type_t;
typedef enum fingerprint_error {
FINGERPRINT_ERROR_HW_UNAVAILABLE = 1,
- FINGERPRINT_ERROR_BAD_CAPTURE = 2
+ FINGERPRINT_ERROR_BAD_CAPTURE = 2,
+ FINGERPRINT_ERROR_TIMEOUT = 3
} fingerprint_error_t;
+typedef struct fingerprint_enroll {
+ uint32_t id;
+ /* samples_remaining goes from N (no data collected, but N scans needed)
+ * to 0 (no more data is needed to build a template)
+ * If HAL fails to decrement samples_remaining between calls the client
+ * will declare template collection a failure and should abort the operation
+ * by calling module->common.methods->close() */
+ uint32_t samples_remaining;
+} fingerprint_enroll_t;
+
+typedef struct fingerprint_scanned {
+ uint32_t id; /* 0 is a special id and means no match */
+ uint32_t confidence; /* Goes form 0 (no match) to 0xffffFFFF (100% sure) */
+} fingerprint_scanned_t;
+
+typedef struct fingerprint_msg {
+ fingerprint_msg_type_t type;
+ union {
+ uint64_t raw;
+ fingerprint_error_t error;
+ fingerprint_enroll_t enroll;
+ fingerprint_scanned_t scan;
+ } data;
+} fingerprint_msg_t;
+
+/* Callback function type */
+typedef void (*fingerprint_notify_t)(fingerprint_msg_t msg);
+
/* Synchronous operation */
typedef struct fingerprint_device {
struct hw_device_t common;
/*
- * Figerprint enroll request: records and stores a fingerprint template.
- * Timeout after temeout_sec seconds.
+ * Fingerprint enroll request:
+ * Switches the HAL state machine to collect and store a new fingerprint
+ * template. Switches back as soon as enroll is complete
+ * (fingerprint_msg.type == FINGERPRINT_TEMPLATE_COLLECTING &&
+ * fingerprint_msg.data.enroll.samples_remaining == 0)
+ * or after timeout_sec seconds.
*
- * Function return:
- * - Machine state: error, collected or registered.
- * - Data is interpreted as error code, collection percentage
- * or fingerprint id.
+ * Function return: 0 if enrollment process can be successfully started
+ * -1 otherwise.
*/
- fingerprint_msg_t (*enroll)(unsigned timeout_sec, unsigned *data);
+ int (*enroll)(struct fingerprint_device *dev, uint32_t timeout_sec);
/*
- * Figerprint remove request: deletes a fingerprint template.
+ * Fingerprint remove request:
+ * deletes a fingerprint template.
+ * If the fingerprint id is 0 the entire template database will be removed.
*
- * Function return:
- * - Delete result: error or success.
+ * Function return: 0 if fingerprint template can be successfully deleted
+ * -1 otherwise.
*/
- fingerprint_msg_t (*remove)(unsigned fingerprint_id);
+ int (*remove)(struct fingerprint_device *dev, uint32_t fingerprint_id);
/*
- * Figerprint match request: Collect a fingerprint and
- * match against stored template with fingerprint_id.
- * Timeout after temeout_sec seconds.
+ * Set notification callback:
+ * Registers a user function that would receive notifications from the HAL
+ * The call will block if the HAL state machine is in busy state until HAL
+ * leaves the busy state.
*
- * Function return:
- * - Match, no match or error.
+ * Function return: 0 if callback function is successfuly registered
+ * -1 otherwise.
*/
- fingerprint_msg_t (*match)(unsigned fingerprint_id, unsigned timeout_sec);
+ int (*set_notify)(struct fingerprint_device *dev,
+ fingerprint_notify_t notify);
+
+ /*
+ * Client provided callback function to receive notifications.
+ * Do not set by hand, use the function above instead.
+ */
+ fingerprint_notify_t notify;
/* Reserved for future use. Must be NULL. */
- void* reserved[8 - 3];
+ void* reserved[8 - 4];
} fingerprint_device_t;
typedef struct fingerprint_module {
struct hw_module_t common;
} fingerprint_module_t;
-/* For asyncronous mode - as a possible API model
-typedef void (*fingerprint_callback)(int request_id, fingerprint_msg msg, data);
-*/
-
#endif /* ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H */
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h
index ca017a0..de4ac0d 100644
--- a/include/hardware/sensors.h
+++ b/include/hardware/sensors.h
@@ -34,6 +34,7 @@
#define SENSORS_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION_2(1, 0, SENSORS_HEADER_VERSION)
#define SENSORS_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION_2(1, 1, SENSORS_HEADER_VERSION)
#define SENSORS_DEVICE_API_VERSION_1_2 HARDWARE_DEVICE_API_VERSION_2(1, 2, SENSORS_HEADER_VERSION)
+#define SENSORS_DEVICE_API_VERSION_1_3 HARDWARE_DEVICE_API_VERSION_2(1, 3, SENSORS_HEADER_VERSION)
/**
* Please see the Sensors section of source.android.com for an
@@ -63,9 +64,12 @@
/*
+ * **** Deprecated *****
* flags for (*batch)()
* Availability: SENSORS_DEVICE_API_VERSION_1_0
- * see (*batch)() documentation for details
+ * see (*batch)() documentation for details.
+ * Deprecated as of SENSORS_DEVICE_API_VERSION_1_3.
+ * WAKE_UP_* sensors replace WAKE_UPON_FIFO_FULL concept.
*/
enum {
SENSORS_BATCH_DRY_RUN = 0x00000001,
@@ -89,6 +93,17 @@
#define SENSOR_PERMISSION_BODY_SENSORS "android.permission.BODY_SENSORS"
/*
+ * Availability: SENSORS_DEVICE_API_VERSION_1_3
+ * Sensor flags used in sensor_t.flags.
+ */
+enum {
+ /*
+ * Whether this sensor wakes up the AP from suspend mode when data is available.
+ */
+ SENSOR_FLAG_WAKE_UP = 1U << 0
+};
+
+/*
* Sensor type
*
* Each sensor has a type which defines what this sensor measures and how
@@ -250,7 +265,7 @@
/*
* SENSOR_TYPE_PROXIMITY
* trigger-mode: on-change
- * wake-up sensor: yes
+ * wake-up sensor: yes (set SENSOR_FLAG_WAKE_UP flag)
*
* The value corresponds to the distance to the nearest object in centimeters.
*/
@@ -348,7 +363,7 @@
/*
* SENSOR_TYPE_SIGNIFICANT_MOTION
* trigger-mode: one-shot
- * wake-up sensor: yes
+ * wake-up sensor: yes (set SENSOR_FLAG_WAKE_UP flag)
*
* A sensor of this type triggers an event each time significant motion
* is detected and automatically disables itself.
@@ -410,6 +425,84 @@
#define SENSOR_TYPE_HEART_RATE (21)
#define SENSOR_STRING_TYPE_HEART_RATE "android.sensor.heart_rate"
+/*
+ * SENSOR_TYPE_NON_WAKE_UP_PROXIMITY_SENSOR
+ * Same as proximity_sensor but does not wake up the AP from suspend mode.
+ * wake-up sensor: no
+ */
+#define SENSOR_TYPE_NON_WAKE_UP_PROXIMITY_SENSOR (22)
+#define SENSOR_STRING_TYPE_NON_WAKE_UP_PROXIMITY_SENSOR "android.sensor.non_wake_up_proximity_sensor"
+
+/*
+ * The sensors below are wake_up variants of the base sensor types defined
+ * above. When registered in batch mode, these sensors will wake up the AP when
+ * their FIFOs are full. A separate FIFO has to be maintained for wake up
+ * sensors and non wake up sensors. The non wake-up sensors need to overwrite
+ * their FIFOs when they are full till the AP wakes up and the wake-up sensors
+ * will wake-up the AP when their FIFOs are full without losing events.
+ *
+ * Define these sensors only if:
+ * 1) batching is supported.
+ * 2) wake-up and non wake-up variants of each sensor can be activated at
+ * different rates.
+ *
+ * wake-up sensor: yes
+ * Set SENSOR_FLAG_WAKE_UP flag for all these sensors.
+ */
+#define SENSOR_TYPE_WAKE_UP_ACCELEROMETER (23)
+#define SENSOR_STRING_TYPE_WAKE_UP_ACCELEROMETER "android.sensor.wake_up_accelerometer"
+
+#define SENSOR_TYPE_WAKE_UP_MAGNETIC_FIELD (24)
+#define SENSOR_STRING_TYPE_WAKE_UP_MAGNETIC_FIELD "android.sensor.wake_up_magnetic_field"
+
+#define SENSOR_TYPE_WAKE_UP_ORIENTATION (25)
+#define SENSOR_STRING_TYPE_WAKE_UP_ORIENTATION "android.sensor.wake_up_orientation"
+
+#define SENSOR_TYPE_WAKE_UP_GYROSCOPE (26)
+#define SENSOR_STRING_TYPE_WAKE_UP_GYROSCOPE "android.sensor.wake_up_gyroscope"
+
+#define SENSOR_TYPE_WAKE_UP_LIGHT (27)
+#define SENSOR_STRING_TYPE_WAKE_UP_LIGHT "android.sensor.wake_up_light"
+
+#define SENSOR_TYPE_WAKE_UP_PRESSURE (28)
+#define SENSOR_STRING_TYPE_WAKE_UP_PRESSURE "android.sensor.wake_up_pressure"
+
+#define SENSOR_TYPE_WAKE_UP_GRAVITY (29)
+#define SENSOR_STRING_TYPE_WAKE_UP_GRAVITY "android.sensor.wake_up_gravity"
+
+#define SENSOR_TYPE_WAKE_UP_LINEAR_ACCELERATION (30)
+#define SENSOR_STRING_TYPE_WAKE_UP_LINEAR_ACCELERATION "android.sensor.wake_up_linear_acceleration"
+
+#define SENSOR_TYPE_WAKE_UP_ROTATION_VECTOR (31)
+#define SENSOR_STRING_TYPE_WAKE_UP_ROTATION_VECTOR "android.sensor.wake_up_rotation_vector"
+
+#define SENSOR_TYPE_WAKE_UP_RELATIVE_HUMIDITY (32)
+#define SENSOR_STRING_TYPE_WAKE_UP_RELATIVE_HUMIDITY "android.sensor.wake_up_relative_humidity"
+
+#define SENSOR_TYPE_WAKE_UP_AMBIENT_TEMPERATURE (33)
+#define SENSOR_STRING_TYPE_WAKE_UP_AMBIENT_TEMPERATURE "android.sensor.wake_up_ambient_temperature"
+
+#define SENSOR_TYPE_WAKE_UP_MAGNETIC_FIELD_UNCALIBRATED (34)
+#define SENSOR_STRING_TYPE_WAKE_UP_MAGNETIC_FIELD_UNCALIBRATED "android.sensor.wake_up_magnetic_field_uncalibrated"
+
+#define SENSOR_TYPE_WAKE_UP_GAME_ROTATION_VECTOR (35)
+#define SENSOR_STRING_TYPE_WAKE_UP_GAME_ROTATION_VECTOR "android.sensor.wake_up_game_rotation_vector"
+
+#define SENSOR_TYPE_WAKE_UP_GYROSCOPE_UNCALIBRATED (36)
+#define SENSOR_STRING_TYPE_WAKE_UP_GYROSCOPE_UNCALIBRATED "android.sensor.wake_up_gyroscope_uncalibrated"
+
+#define SENSOR_TYPE_WAKE_UP_STEP_DETECTOR (37)
+#define SENSOR_STRING_TYPE_WAKE_UP_STEP_DETECTOR "android.sensor.wake_up_step_detector"
+
+#define SENSOR_TYPE_WAKE_UP_STEP_COUNTER (38)
+#define SENSOR_STRING_TYPE_WAKE_UP_STEP_COUNTER "android.sensor.wake_up_step_counter"
+
+#define SENSOR_TYPE_WAKE_UP_GEOMAGNETIC_ROTATION_VECTOR (39)
+#define SENSOR_STRING_TYPE_WAKE_UP_GEOMAGNETIC_ROTATION_VECTOR "android.sensor.wake_up_geomagnetic_rotation_vector"
+
+#define SENSOR_TYPE_WAKE_UP_HEART_RATE (40)
+#define SENSOR_STRING_TYPE_WAKE_UP_HEART_RATE "android.sensor.wake_up_heart_rate"
+
/**
* Values returned by the accelerometer in various locations in the universe.
* all values are in SI units (m/s^2)
@@ -556,7 +649,11 @@
uint64_t step_counter;
} u64;
};
- uint32_t reserved1[4];
+
+ /* Reserved flags for internal use. Set to zero. */
+ uint32_t flags;
+
+ uint32_t reserved1[3];
} sensors_event_t;
@@ -596,7 +693,7 @@
* must increase when the driver is updated in a way that changes the
* output of this sensor. This is important for fused sensors when the
* fusion algorithm is updated.
- */
+ */
int version;
/* handle that identifies this sensors. This handle is used to reference
@@ -657,8 +754,31 @@
*/
const char* requiredPermission;
+ /* This value is defined only for continuous mode sensors. It is the delay between two
+ * sensor events corresponding to the lowest frequency that this sensor supports. When
+ * lower frequencies are requested through batch()/setDelay() the events will be generated
+ * at this frequency instead. It can be used by the framework or applications to estimate
+ * when the batch FIFO may be full.
+ * NOTE: period_ns is in nanoseconds where as maxDelay/minDelay are in microseconds.
+ * continuous: maximum sampling period allowed in microseconds.
+ * on-change, one-shot, special : -1
+ * Availability: SENSORS_DEVICE_API_VERSION_1_3
+ */
+ #ifdef __LP64__
+ int64_t maxDelay;
+ #else
+ int32_t maxDelay;
+ #endif
+
+ /* Flags for sensor. See SENSOR_FLAG_* above. */
+ #ifdef __LP64__
+ uint64_t flags;
+ #else
+ uint32_t flags;
+ #endif
+
/* reserved fields, must be zero */
- void* reserved[4];
+ void* reserved[2];
};
@@ -703,7 +823,9 @@
int handle, int enabled);
/**
- * Set the events's period in nanoseconds for a given sensor.
+ * Set the events's period in nanoseconds for a given sensor. If
+ * period_ns > max_delay it will be truncated to max_delay and if
+ * period_ns < min_delay it will be replaced by min_delay.
*/
int (*setDelay)(struct sensors_poll_device_t *dev,
int handle, int64_t period_ns);
diff --git a/modules/audio/Android.mk b/modules/audio/Android.mk
index 84d8203..a31c85f 100644
--- a/modules/audio/Android.mk
+++ b/modules/audio/Android.mk
@@ -27,7 +27,7 @@
LOCAL_SRC_FILES := audio_hw.c
LOCAL_SHARED_LIBRARIES := liblog libcutils
LOCAL_MODULE_TAGS := optional
-LOCAL_32_BIT_ONLY := true
+LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_SHARED_LIBRARY)
@@ -40,6 +40,6 @@
LOCAL_SRC_FILES := audio_policy.c
LOCAL_SHARED_LIBRARIES := liblog libcutils
LOCAL_MODULE_TAGS := optional
-LOCAL_32_BIT_ONLY := true
+LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/audio_remote_submix/Android.mk b/modules/audio_remote_submix/Android.mk
index d718c76..90da396 100644
--- a/modules/audio_remote_submix/Android.mk
+++ b/modules/audio_remote_submix/Android.mk
@@ -26,6 +26,7 @@
LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libnbaio
LOCAL_STATIC_LIBRARIES := libmedia_helper
LOCAL_MODULE_TAGS := optional
-LOCAL_32_BIT_ONLY := true
+LOCAL_CFLAGS := -Wno-unused-parameter
+
include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp
index 6b14aa5..22e2dbf 100644
--- a/modules/audio_remote_submix/audio_hw.cpp
+++ b/modules/audio_remote_submix/audio_hw.cpp
@@ -271,7 +271,7 @@
return 0;
} else {
// write() returned UNDERRUN or WOULD_BLOCK, retry
- ALOGE("out_write() write to pipe returned unexpected %d", written_frames);
+ ALOGE("out_write() write to pipe returned unexpected %zd", written_frames);
written_frames = sink->write(buffer, frames);
}
}
@@ -281,10 +281,10 @@
pthread_mutex_unlock(&out->dev->lock);
if (written_frames < 0) {
- ALOGE("out_write() failed writing to pipe with %d", written_frames);
+ ALOGE("out_write() failed writing to pipe with %zd", written_frames);
return 0;
} else {
- ALOGV("out_write() wrote %lu bytes)", written_frames * frame_size);
+ ALOGV("out_write() wrote %zu bytes)", written_frames * frame_size);
return written_frames * frame_size;
}
}
@@ -327,7 +327,7 @@
static size_t in_get_buffer_size(const struct audio_stream *stream)
{
const struct submix_stream_in *in = reinterpret_cast<const struct submix_stream_in *>(stream);
- ALOGV("in_get_buffer_size() returns %u",
+ ALOGV("in_get_buffer_size() returns %zu",
in->dev->config.period_size * audio_stream_frame_size(stream));
return in->dev->config.period_size * audio_stream_frame_size(stream);
}
@@ -449,7 +449,7 @@
}
if (remaining_frames > 0) {
- ALOGV(" remaining_frames = %d", remaining_frames);
+ ALOGV(" remaining_frames = %zu", remaining_frames);
memset(((char*)buffer)+ bytes - (remaining_frames * frame_size), 0,
remaining_frames * frame_size);
}
@@ -488,7 +488,7 @@
}
- ALOGV("in_read returns %d", bytes);
+ ALOGV("in_read returns %zu", bytes);
return bytes;
}
diff --git a/modules/camera/Camera.cpp b/modules/camera/Camera.cpp
index 0ddf001..1f22e00 100644
--- a/modules/camera/Camera.cpp
+++ b/modules/camera/Camera.cpp
@@ -569,17 +569,26 @@
{
camdev_to_camera(dev)->dump(fd);
}
+
+static int flush(const camera3_device_t*)
+{
+ ALOGE("%s: unimplemented.", __func__);
+ return -1;
+}
+
} // extern "C"
const camera3_device_ops_t Camera::sOps = {
- .initialize = default_camera_hal::initialize,
- .configure_streams = default_camera_hal::configure_streams,
+ .initialize = default_camera_hal::initialize,
+ .configure_streams = default_camera_hal::configure_streams,
.register_stream_buffers = default_camera_hal::register_stream_buffers,
- .construct_default_request_settings =
- default_camera_hal::construct_default_request_settings,
+ .construct_default_request_settings
+ = default_camera_hal::construct_default_request_settings,
.process_capture_request = default_camera_hal::process_capture_request,
.get_metadata_vendor_tag_ops = NULL,
- .dump = default_camera_hal::dump
+ .dump = default_camera_hal::dump,
+ .flush = default_camera_hal::flush,
+ .reserved = {0},
};
} // namespace default_camera_hal
diff --git a/modules/camera/CameraHAL.cpp b/modules/camera/CameraHAL.cpp
index 148f99c..b04cf0c 100644
--- a/modules/camera/CameraHAL.cpp
+++ b/modules/camera/CameraHAL.cpp
@@ -183,7 +183,8 @@
get_number_of_cameras : get_number_of_cameras,
get_camera_info : get_camera_info,
set_callbacks : set_callbacks,
- get_vendor_tag_ops : get_vendor_tag_ops
+ get_vendor_tag_ops : get_vendor_tag_ops,
+ reserved : {0},
};
} // extern "C"
diff --git a/modules/camera/ExampleCamera.cpp b/modules/camera/ExampleCamera.cpp
index a275190..ca28b99 100644
--- a/modules/camera/ExampleCamera.cpp
+++ b/modules/camera/ExampleCamera.cpp
@@ -184,25 +184,37 @@
// Create standard settings templates from copies of base metadata
// TODO: use vendor tags in base metadata
- if (res = base.add1UInt8(ANDROID_CONTROL_MODE, ANDROID_CONTROL_MODE_OFF))
+ res = base.add1UInt8(ANDROID_CONTROL_MODE, ANDROID_CONTROL_MODE_OFF);
+ if (res)
return res;
// Use base settings to create all other templates and set them
- if (res = setPreviewTemplate(base)) return res;
- if (res = setStillTemplate(base)) return res;
- if (res = setRecordTemplate(base)) return res;
- if (res = setSnapshotTemplate(base)) return res;
- if (res = setZslTemplate(base)) return res;
+ res = setPreviewTemplate(base);
+ if (res)
+ return res;
+ res = setStillTemplate(base);
+ if (res)
+ return res;
+ res = setRecordTemplate(base);
+ if (res)
+ return res;
+ res = setSnapshotTemplate(base);
+ if (res)
+ return res;
+ res = setZslTemplate(base);
+ if (res)
+ return res;
return 0;
}
int ExampleCamera::setPreviewTemplate(Metadata m)
{
- int res;
// Setup default preview controls
- if (res = m.add1UInt8(ANDROID_CONTROL_CAPTURE_INTENT,
- ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW))
+ int res = m.add1UInt8(ANDROID_CONTROL_CAPTURE_INTENT,
+ ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW);
+
+ if (res)
return res;
// TODO: set fast auto-focus, auto-whitebalance, auto-exposure, auto flash
return setTemplate(CAMERA3_TEMPLATE_PREVIEW, m.get());
@@ -210,10 +222,10 @@
int ExampleCamera::setStillTemplate(Metadata m)
{
- int res;
+ int res = m.add1UInt8(ANDROID_CONTROL_CAPTURE_INTENT,
+ ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE);
// Setup default still capture controls
- if (res = m.add1UInt8(ANDROID_CONTROL_CAPTURE_INTENT,
- ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE))
+ if (res)
return res;
// TODO: set fast auto-focus, auto-whitebalance, auto-exposure, auto flash
return setTemplate(CAMERA3_TEMPLATE_STILL_CAPTURE, m.get());
@@ -221,10 +233,10 @@
int ExampleCamera::setRecordTemplate(Metadata m)
{
- int res;
+ int res = m.add1UInt8(ANDROID_CONTROL_CAPTURE_INTENT,
+ ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD);
// Setup default video record controls
- if (res = m.add1UInt8(ANDROID_CONTROL_CAPTURE_INTENT,
- ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD))
+ if (res)
return res;
// TODO: set slow auto-focus, auto-whitebalance, auto-exposure, flash off
return setTemplate(CAMERA3_TEMPLATE_VIDEO_RECORD, m.get());
@@ -232,21 +244,21 @@
int ExampleCamera::setSnapshotTemplate(Metadata m)
{
- int res;
+ int res = m.add1UInt8(ANDROID_CONTROL_CAPTURE_INTENT,
+ ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT);
// Setup default video snapshot controls
- if (res = m.add1UInt8(ANDROID_CONTROL_CAPTURE_INTENT,
- ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT))
+ if (res)
return res;
- // TODO: set slow auto-focus, auto-whitebalance, auto-exposure, flash off
+ // TODO: set slow auto-focus, auto-whitebalance, auto-exposure, flash off
return setTemplate(CAMERA3_TEMPLATE_VIDEO_SNAPSHOT, m.get());
}
int ExampleCamera::setZslTemplate(Metadata m)
{
- int res;
+ int res = m.add1UInt8(ANDROID_CONTROL_CAPTURE_INTENT,
+ ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG);
// Setup default zero shutter lag controls
- if (res = m.add1UInt8(ANDROID_CONTROL_CAPTURE_INTENT,
- ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG))
+ if (res)
return res;
// TODO: set reprocessing parameters for zsl input queue
return setTemplate(CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG, m.get());
diff --git a/modules/camera/Metadata.cpp b/modules/camera/Metadata.cpp
index 72314d5..f195534 100644
--- a/modules/camera/Metadata.cpp
+++ b/modules/camera/Metadata.cpp
@@ -143,18 +143,20 @@
// Double new dimensions to minimize future reallocations
tmp = allocate_camera_metadata(entry_capacity * 2, data_capacity * 2);
if (tmp == NULL) {
- ALOGE("%s: Failed to allocate new metadata with %d entries, %d data",
+ ALOGE("%s: Failed to allocate new metadata with %zu entries, %zu data",
__func__, entry_capacity, data_capacity);
return -ENOMEM;
}
// Append the current metadata to the new (empty) metadata
- if (res = append_camera_metadata(tmp, mData)) {
+ res = append_camera_metadata(tmp, mData);
+ if (res) {
ALOGE("%s: Failed to append old metadata %p to new %p",
__func__, mData, tmp);
return res;
}
// Add the remaining new item
- if (res = add_camera_metadata_entry(tmp, tag, tag_data, count)) {
+ res = add_camera_metadata_entry(tmp, tag, tag_data, count);
+ if (res) {
ALOGE("%s: Failed to add new entry (%d, %p, %d) to metadata %p",
__func__, tag, tag_data, count, tmp);
return res;
diff --git a/modules/camera/Stream.cpp b/modules/camera/Stream.cpp
index 9b9ab98..b846a71 100644
--- a/modules/camera/Stream.cpp
+++ b/modules/camera/Stream.cpp
@@ -227,15 +227,16 @@
fdprintf(fd, "Stream ID: %d (%p)\n", mId, mStream);
fdprintf(fd, "Stream Type: %s (%d)\n", typeToString(mType), mType);
- fdprintf(fd, "Width: %u Height: %u\n", mWidth, mHeight);
+ fdprintf(fd, "Width: %"PRIu32" Height: %"PRIu32"\n", mWidth, mHeight);
fdprintf(fd, "Stream Format: %s (%d)", formatToString(mFormat), mFormat);
// ToDo: prettyprint usage mask flags
- fdprintf(fd, "Gralloc Usage Mask: 0x%x\n", mUsage);
- fdprintf(fd, "Max Buffer Count: %d\n", mMaxBuffers);
+ fdprintf(fd, "Gralloc Usage Mask: %#"PRIx32"\n", mUsage);
+ fdprintf(fd, "Max Buffer Count: %"PRIu32"\n", mMaxBuffers);
fdprintf(fd, "Buffers Registered: %s\n", mRegistered ? "true" : "false");
- fdprintf(fd, "Number of Buffers: %d\n", mNumBuffers);
- for (int i = 0; i < mNumBuffers; i++) {
- fdprintf(fd, "Buffer %d/%d: %p\n", i, mNumBuffers, mBuffers[i]);
+ fdprintf(fd, "Number of Buffers: %"PRIu32"\n", mNumBuffers);
+ for (uint32_t i = 0; i < mNumBuffers; i++) {
+ fdprintf(fd, "Buffer %"PRIu32"/%"PRIu32": %p\n", i, mNumBuffers,
+ mBuffers[i]);
}
}
diff --git a/modules/camera/VendorTags.cpp b/modules/camera/VendorTags.cpp
index 58bd606..2c54648 100644
--- a/modules/camera/VendorTags.cpp
+++ b/modules/camera/VendorTags.cpp
@@ -46,53 +46,53 @@
};
// Entry arrays for each section
-const Entry DemoWizardry[DEMO_WIZARDRY_END - DEMO_WIZARDRY_START] = {
- [DEMO_WIZARDRY_DIMENSION_SIZE - DEMO_WIZARDRY_START] =
+const Entry DemoWizardry[demo_wizardry_end - demo_wizardry_start] = {
+ [demo_wizardry_dimension_size - demo_wizardry_start] =
{"dimensionSize", TYPE_INT32},
- [DEMO_WIZARDRY_DIMENSIONS - DEMO_WIZARDRY_START] =
+ [demo_wizardry_dimensions - demo_wizardry_start] =
{"dimensions", TYPE_INT32},
- [DEMO_WIZARDRY_FAMILIAR - DEMO_WIZARDRY_START] =
+ [demo_wizardry_familiar - demo_wizardry_start] =
{"familiar", TYPE_BYTE},
- [DEMO_WIZARDRY_FIRE - DEMO_WIZARDRY_START] =
+ [demo_wizardry_fire - demo_wizardry_start] =
{"fire", TYPE_RATIONAL}
};
-const Entry DemoSorcery[DEMO_SORCERY_END - DEMO_SORCERY_START] = {
- [DEMO_SORCERY_DIFFICULTY - DEMO_SORCERY_START] =
+const Entry DemoSorcery[demo_sorcery_end - demo_sorcery_start] = {
+ [demo_sorcery_difficulty - demo_sorcery_start] =
{"difficulty", TYPE_INT64},
- [DEMO_SORCERY_LIGHT - DEMO_SORCERY_START] =
+ [demo_sorcery_light - demo_sorcery_start] =
{"light", TYPE_BYTE}
};
-const Entry DemoMagic[DEMO_MAGIC_END - DEMO_MAGIC_START] = {
- [DEMO_MAGIC_CARD_TRICK - DEMO_MAGIC_START] =
+const Entry DemoMagic[demo_magic_end - demo_magic_start] = {
+ [demo_magic_card_trick - demo_magic_start] =
{"cardTrick", TYPE_DOUBLE},
- [DEMO_MAGIC_LEVITATION - DEMO_MAGIC_START] =
+ [demo_magic_levitation - demo_magic_start] =
{"levitation", TYPE_FLOAT}
};
// Array of all sections
const Section DemoSections[DEMO_SECTION_COUNT] = {
[DEMO_WIZARDRY] = { "demo.wizardry",
- DEMO_WIZARDRY_START,
- DEMO_WIZARDRY_END,
+ demo_wizardry_start,
+ demo_wizardry_end,
DemoWizardry },
[DEMO_SORCERY] = { "demo.sorcery",
- DEMO_SORCERY_START,
- DEMO_SORCERY_END,
+ demo_sorcery_start,
+ demo_sorcery_end,
DemoSorcery },
[DEMO_MAGIC] = { "demo.magic",
- DEMO_MAGIC_START,
- DEMO_MAGIC_END,
+ demo_magic_start,
+ demo_magic_end,
DemoMagic }
};
// Get a static handle to a specific vendor tag section
const Section* getSection(uint32_t tag)
{
- uint32_t section = (tag - VENDOR_SECTION_START) >> 16;
+ uint32_t section = (tag - vendor_section_start) >> 16;
- if (tag < VENDOR_SECTION_START) {
+ if (tag < vendor_section_start) {
ALOGE("%s: Tag 0x%x before vendor section", __func__, tag);
return NULL;
}
diff --git a/modules/camera/VendorTags.h b/modules/camera/VendorTags.h
index 9af9f7d..ecf777e 100644
--- a/modules/camera/VendorTags.h
+++ b/modules/camera/VendorTags.h
@@ -49,29 +49,28 @@
DEMO_SECTION_COUNT
};
+const uint32_t vendor_section_start = VENDOR_SECTION_START;
+
// Each section starts at increments of 0x1_0000
-enum {
- DEMO_WIZARDRY_START = (DEMO_WIZARDRY + VENDOR_SECTION) << 16,
- DEMO_SORCERY_START = (DEMO_SORCERY + VENDOR_SECTION) << 16,
- DEMO_MAGIC_START = (DEMO_MAGIC + VENDOR_SECTION) << 16,
-};
+const uint32_t demo_wizardry_start = (DEMO_WIZARDRY + VENDOR_SECTION) << 16;
+const uint32_t demo_sorcery_start = (DEMO_SORCERY + VENDOR_SECTION) << 16;
+const uint32_t demo_magic_start = (DEMO_MAGIC + VENDOR_SECTION) << 16;
// Vendor Tag values, start value begins each section
-enum {
- DEMO_WIZARDRY_DIMENSION_SIZE = DEMO_WIZARDRY_START,
- DEMO_WIZARDRY_DIMENSIONS,
- DEMO_WIZARDRY_FAMILIAR,
- DEMO_WIZARDRY_FIRE,
- DEMO_WIZARDRY_END,
+const uint32_t demo_wizardry_dimension_size = demo_wizardry_start;
+const uint32_t demo_wizardry_dimensions = demo_wizardry_start + 1;
+const uint32_t demo_wizardry_familiar = demo_wizardry_start + 2;
+const uint32_t demo_wizardry_fire = demo_wizardry_start + 3;
+const uint32_t demo_wizardry_end = demo_wizardry_start + 4;
- DEMO_SORCERY_DIFFICULTY = DEMO_SORCERY_START,
- DEMO_SORCERY_LIGHT,
- DEMO_SORCERY_END,
+const uint32_t demo_sorcery_difficulty = demo_sorcery_start;
+const uint32_t demo_sorcery_light = demo_sorcery_start + 1;
+const uint32_t demo_sorcery_end = demo_sorcery_start + 2;
- DEMO_MAGIC_CARD_TRICK = DEMO_MAGIC_START,
- DEMO_MAGIC_LEVITATION,
- DEMO_MAGIC_END,
-};
+const uint32_t demo_magic_card_trick = demo_magic_start;
+const uint32_t demo_magic_levitation = demo_magic_start + 1;
+const uint32_t demo_magic_end = demo_magic_start + 2;
+
} // namespace default_camera_hal
#endif // VENDOR_TAGS_H_
diff --git a/modules/fingerprint/fingerprint.c b/modules/fingerprint/fingerprint.c
index a7691ed..14dac12 100644
--- a/modules/fingerprint/fingerprint.c
+++ b/modules/fingerprint/fingerprint.c
@@ -31,30 +31,26 @@
}
}
-static fingerprint_msg_t fingerprint_enroll(unsigned timeout_sec,
- unsigned *data) {
- (void)timeout_sec;
- (void)data;
+static int fingerprint_enroll(struct fingerprint_device __unused *dev,
+ uint32_t __unused timeout_sec) {
return FINGERPRINT_ERROR;
}
-static fingerprint_msg_t fingerprint_remove(unsigned fingerprint_id) {
- (void)fingerprint_id;
+static int fingerprint_remove(struct fingerprint_device __unused *dev,
+ uint32_t __unused fingerprint_id) {
return FINGERPRINT_ERROR;
}
-static fingerprint_msg_t fingerprint_match(unsigned fingerprint_id,
- unsigned timeout_sec) {
- (void)fingerprint_id;
- (void)timeout_sec;
+static int set_notify_callback(struct fingerprint_device *dev,
+ fingerprint_notify_t notify) {
+ /* Decorate with locks */
+ dev->notify = notify;
return FINGERPRINT_ERROR;
}
-static int fingerprint_open(const hw_module_t* module, const char* id,
+static int fingerprint_open(const hw_module_t* module, const char __unused *id,
hw_device_t** device)
{
- (void)id;
-
if (device == NULL) {
ALOGE("NULL device on open");
return -EINVAL;
@@ -70,7 +66,8 @@
dev->enroll = fingerprint_enroll;
dev->remove = fingerprint_remove;
- dev->match = fingerprint_match;
+ dev->set_notify = set_notify_callback;
+ dev->notify = NULL;
*device = (hw_device_t*) dev;
return 0;
diff --git a/modules/usbaudio/Android.mk b/modules/usbaudio/Android.mk
index 2acd171..2af7897 100644
--- a/modules/usbaudio/Android.mk
+++ b/modules/usbaudio/Android.mk
@@ -24,7 +24,7 @@
external/tinyalsa/include
LOCAL_SHARED_LIBRARIES := liblog libcutils libtinyalsa
LOCAL_MODULE_TAGS := optional
-LOCAL_32_BIT_ONLY := true
+LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/camera2/CameraBurstTests.cpp b/tests/camera2/CameraBurstTests.cpp
index 51a6b0e..65ff460 100644
--- a/tests/camera2/CameraBurstTests.cpp
+++ b/tests/camera2/CameraBurstTests.cpp
@@ -15,6 +15,7 @@
*/
#include <gtest/gtest.h>
+#include <inttypes.h>
#define LOG_TAG "CameraBurstTest"
//#define LOG_NDEBUG 0
@@ -218,7 +219,7 @@
CameraMetadata tmpRequest = previewRequest;
ASSERT_EQ(OK, tmpRequest.update(ANDROID_SENSOR_EXPOSURE_TIME,
&exposures[i], 1));
- ALOGV("Submitting capture request %d with exposure %lld", i,
+ ALOGV("Submitting capture request %d with exposure %"PRId64, i,
exposures[i]);
dout << "Capture request " << i << " exposure is "
<< (exposures[i]/1e6f) << std::endl;
@@ -230,7 +231,7 @@
float brightnesses[CAMERA_FRAME_BURST_COUNT];
// Get each frame (metadata) and then the buffer. Calculate brightness.
for (int i = 0; i < CAMERA_FRAME_BURST_COUNT; ++i) {
- ALOGV("Reading capture request %d with exposure %lld", i, exposures[i]);
+ ALOGV("Reading capture request %d with exposure %"PRId64, i, exposures[i]);
ASSERT_EQ(OK, mDevice->waitForNextFrame(CAMERA_FRAME_TIMEOUT));
ALOGV("Reading capture request-1 %d", i);
CaptureResult result;
@@ -613,7 +614,7 @@
&durationList[i], 1));
ASSERT_EQ(OK, tmpRequest.update(ANDROID_SENSOR_SENSITIVITY,
&sensitivityList[i], 1));
- ALOGV("Submitting capture %d with exposure %lld, frame duration %lld, sensitivity %d",
+ ALOGV("Submitting capture %zu with exposure %"PRId64", frame duration %"PRId64", sensitivity %d",
i, expList[i], durationList[i], sensitivityList[i]);
dout << "Capture request " << i <<
": exposure is " << (expList[i]/1e6f) << " ms" <<
@@ -631,7 +632,7 @@
// Get each frame (metadata) and then the buffer. Calculate brightness.
for (size_t i = 0; i < expList.size(); ++i) {
- ALOGV("Reading request %d", i);
+ ALOGV("Reading request %zu", i);
dout << "Waiting for capture " << i << ": " <<
" exposure " << (expList[i]/1e6f) << " ms," <<
" frame duration " << (durationList[i]/1e6f) << " ms," <<
@@ -644,10 +645,10 @@
if (durationList[i] * 2 > waitLimit) waitLimit = durationList[i] * 2;
ASSERT_EQ(OK, mDevice->waitForNextFrame(waitLimit));
- ALOGV("Reading capture request-1 %d", i);
+ ALOGV("Reading capture request-1 %zu", i);
CaptureResult result;
ASSERT_EQ(OK, mDevice->getNextResult(&result));
- ALOGV("Reading capture request-2 %d", i);
+ ALOGV("Reading capture request-2 %zu", i);
ASSERT_EQ(OK, mFrameListener->waitForFrame(CAMERA_FRAME_TIMEOUT));
ALOGV("We got the frame now");
@@ -668,7 +669,7 @@
avgBrightness = 255;
}
- ALOGV("Total brightness for frame %d was %lld (underexposed %d, "
+ ALOGV("Total brightness for frame %zu was %lld (underexposed %d, "
"overexposed %d), avg %f", i, brightness, underexposed,
overexposed, avgBrightness);
dout << "Average brightness (frame " << i << ") was " << avgBrightness
@@ -711,7 +712,7 @@
if (dumpFrames) {
String8 dumpName =
- String8::format("/data/local/tmp/camera2_test_variable_burst_frame_%03d.yuv", i);
+ String8::format("/data/local/tmp/camera2_test_variable_burst_frame_%03zu.yuv", i);
dout << " Writing YUV dump to " << dumpName << std::endl;
DumpYuvToFile(dumpName, imgBuffer);
}
diff --git a/tests/camera2/CameraMultiStreamTests.cpp b/tests/camera2/CameraMultiStreamTests.cpp
index c7db679..536b656 100644
--- a/tests/camera2/CameraMultiStreamTests.cpp
+++ b/tests/camera2/CameraMultiStreamTests.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <inttypes.h>
#define LOG_TAG "CameraMultiStreamTest"
//#define LOG_NDEBUG 0
#include "CameraStreamFixture.h"
@@ -355,7 +356,7 @@
ASSERT_EQ(OK, request.update(ANDROID_SENSOR_EXPOSURE_TIME, &exposures[i], 1));
ASSERT_EQ(OK, request.update(ANDROID_SENSOR_SENSITIVITY, &sensitivities[i], 1));
ASSERT_EQ(OK, mDevice->capture(request));
- ALOGV("Submitting request with: id %d with exposure %lld, sensitivity %d",
+ ALOGV("Submitting request with: id %d with exposure %"PRId64", sensitivity %d",
*requestIdStart, exposures[i], sensitivities[i]);
if (CAMERA_MULTI_STREAM_DEBUGGING) {
request.dump(STDOUT_FILENO);
@@ -370,7 +371,7 @@
// Set wait limit based on expected frame duration.
int64_t waitLimit = CAMERA_FRAME_TIMEOUT;
for (size_t i = 0; i < requestCount; i++) {
- ALOGV("Reading request result %d", i);
+ ALOGV("Reading request result %zu", i);
/**
* Raise the timeout to be at least twice as long as the exposure
@@ -396,7 +397,7 @@
}
} while (resultRequestId != targetRequestId);
targetRequestId++;
- ALOGV("Got capture burst result for request %d", i);
+ ALOGV("Got capture burst result for request %zu", i);
// Validate capture result
if (CAMERA_MULTI_STREAM_DEBUGGING) {
@@ -415,7 +416,7 @@
captureBurstTimes.push_back(systemTime());
CpuConsumer::LockedBuffer imgBuffer;
ASSERT_EQ(OK, consumer->lockNextBuffer(&imgBuffer));
- ALOGV("Got capture buffer for request %d", i);
+ ALOGV("Got capture buffer for request %zu", i);
/**
* TODO: Validate capture buffer. Current brightness calculation
@@ -527,7 +528,7 @@
minFrameDuration = DEFAULT_FRAME_DURATION;
}
- ALOGV("targeted minimal frame duration is: %lldns", minFrameDuration);
+ ALOGV("targeted minimal frame duration is: %"PRId64"ns", minFrameDuration);
data = &(availableJpegSizes.data.i32[0]);
count = availableJpegSizes.count;
@@ -647,7 +648,7 @@
ASSERT_EQ(OK, previewRequest.update(
ANDROID_SENSOR_EXPOSURE_TIME,
&exposures[i], 1));
- ALOGV("Submitting preview request %d with exposure %lld",
+ ALOGV("Submitting preview request %zu with exposure %"PRId64,
i, exposures[i]);
ASSERT_EQ(OK, mDevice->setStreamingRequest(previewRequest));
diff --git a/tests/fingerprint/fingerprint_tests.cpp b/tests/fingerprint/fingerprint_tests.cpp
index ad6e1dd..4463751 100644
--- a/tests/fingerprint/fingerprint_tests.cpp
+++ b/tests/fingerprint/fingerprint_tests.cpp
@@ -21,17 +21,17 @@
TEST_F(FingerprintDevice, isThereEnroll) {
ASSERT_TRUE(NULL != fp_device()->enroll)
- << "Enroll function is not implemented";
+ << "enroll() function is not implemented";
}
TEST_F(FingerprintDevice, isThereRemove) {
ASSERT_TRUE(NULL != fp_device()->remove)
- << "Remove function is not implemented";
+ << "remove() function is not implemented";
}
-TEST_F(FingerprintDevice, isThereMatch) {
- ASSERT_TRUE(NULL != fp_device()->match)
- << "Match function is not implemented";
+TEST_F(FingerprintDevice, isThereSetNotify) {
+ ASSERT_TRUE(NULL != fp_device()->set_notify)
+ << "set_notify() function is not implemented";
}
} // namespace tests
diff --git a/tests/hardware/struct-offset.cpp b/tests/hardware/struct-offset.cpp
index bdb1fad..523becc 100644
--- a/tests/hardware/struct-offset.cpp
+++ b/tests/hardware/struct-offset.cpp
@@ -88,6 +88,8 @@
CHECK_MEMBER_AT(sensors_event_t, u64, 24, 24);
CHECK_MEMBER_AT(sensors_event_t, u64.data, 24, 24);
CHECK_MEMBER_AT(sensors_event_t, u64.step_counter, 24, 24);
+ CHECK_MEMBER_AT(sensors_event_t, flags, 88, 88);
+ CHECK_MEMBER_AT(sensors_event_t, reserved1, 92, 92);
CHECK_MEMBER_AT(struct sensor_t, name, 0, 0);
CHECK_MEMBER_AT(struct sensor_t, vendor, 4, 8);
@@ -100,6 +102,11 @@
CHECK_MEMBER_AT(struct sensor_t, minDelay, 32, 40);
CHECK_MEMBER_AT(struct sensor_t, fifoReservedEventCount, 36, 44);
CHECK_MEMBER_AT(struct sensor_t, fifoMaxEventCount, 40, 48);
+ CHECK_MEMBER_AT(struct sensor_t, stringType, 44, 56);
+ CHECK_MEMBER_AT(struct sensor_t, requiredPermission, 48, 64);
+ CHECK_MEMBER_AT(struct sensor_t, maxDelay, 52, 72);
+ CHECK_MEMBER_AT(struct sensor_t, flags, 56, 80);
+ CHECK_MEMBER_AT(struct sensor_t, reserved, 60, 88);
CHECK_MEMBER_AT(sensors_poll_device_1_t, v0, 0, 0);
CHECK_MEMBER_AT(sensors_poll_device_1_t, common, 0, 0);