Merge "vibrator: fix issue with ledtrig-transient support" am: 60849b8da4 am: 95d22ed018
am: fdfbcda7ad
Change-Id: Ib2df8e109d5842e3d3eaa0846a153c997908d967
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index c95ad09..2d6eb30 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -22,6 +22,7 @@
#include <strings.h>
#include <sys/cdefs.h>
#include <sys/types.h>
+#include <time.h>
#include <cutils/bitops.h>
@@ -59,19 +60,6 @@
/* Minimal audio HAL version supported by the audio framework */
#define AUDIO_DEVICE_API_VERSION_MIN AUDIO_DEVICE_API_VERSION_2_0
-/**
- * List of known audio HAL modules. This is the base name of the audio HAL
- * library composed of the "audio." prefix, one of the base names below and
- * a suffix specific to the device.
- * e.g: audio.primary.goldfish.so or audio.a2dp.default.so
- */
-
-#define AUDIO_HARDWARE_MODULE_ID_PRIMARY "primary"
-#define AUDIO_HARDWARE_MODULE_ID_A2DP "a2dp"
-#define AUDIO_HARDWARE_MODULE_ID_USB "usb"
-#define AUDIO_HARDWARE_MODULE_ID_REMOTE_SUBMIX "r_submix"
-#define AUDIO_HARDWARE_MODULE_ID_CODEC_OFFLOAD "codec_offload"
-
/**************************************/
/**
@@ -82,11 +70,6 @@
* audio device parameters
*/
-/* BT SCO Noise Reduction + Echo Cancellation parameters */
-#define AUDIO_PARAMETER_KEY_BT_NREC "bt_headset_nrec"
-#define AUDIO_PARAMETER_VALUE_ON "on"
-#define AUDIO_PARAMETER_VALUE_OFF "off"
-
/* TTY mode selection */
#define AUDIO_PARAMETER_KEY_TTY_MODE "tty_mode"
#define AUDIO_PARAMETER_VALUE_TTY_OFF "tty_off"
@@ -94,8 +77,7 @@
#define AUDIO_PARAMETER_VALUE_TTY_HCO "tty_hco"
#define AUDIO_PARAMETER_VALUE_TTY_FULL "tty_full"
-/* Hearing Aid Compatibility - Telecoil (HAC-T) mode on/off
- Strings must be in sync with CallFeaturesSetting.java */
+/* Hearing Aid Compatibility - Telecoil (HAC-T) mode on/off */
#define AUDIO_PARAMETER_KEY_HAC "HACSetting"
#define AUDIO_PARAMETER_VALUE_HAC_ON "ON"
#define AUDIO_PARAMETER_VALUE_HAC_OFF "OFF"
@@ -106,63 +88,15 @@
/* A2DP source address set by framework */
#define AUDIO_PARAMETER_A2DP_SOURCE_ADDRESS "a2dp_source_address"
-/* Screen state */
-#define AUDIO_PARAMETER_KEY_SCREEN_STATE "screen_state"
-
/* Bluetooth SCO wideband */
#define AUDIO_PARAMETER_KEY_BT_SCO_WB "bt_wbs"
-/* Get a new HW synchronization source identifier.
- * Return a valid source (positive integer) or AUDIO_HW_SYNC_INVALID if an error occurs
- * or no HW sync is available. */
-#define AUDIO_PARAMETER_HW_AV_SYNC "hw_av_sync"
-
/**
* audio stream parameters
*/
-#define AUDIO_PARAMETER_STREAM_ROUTING "routing" /* audio_devices_t */
-#define AUDIO_PARAMETER_STREAM_FORMAT "format" /* audio_format_t */
-#define AUDIO_PARAMETER_STREAM_CHANNELS "channels" /* audio_channel_mask_t */
-#define AUDIO_PARAMETER_STREAM_FRAME_COUNT "frame_count" /* size_t */
-#define AUDIO_PARAMETER_STREAM_INPUT_SOURCE "input_source" /* audio_source_t */
-#define AUDIO_PARAMETER_STREAM_SAMPLING_RATE "sampling_rate" /* uint32_t */
-
-#define AUDIO_PARAMETER_DEVICE_CONNECT "connect" /* audio_devices_t */
-#define AUDIO_PARAMETER_DEVICE_DISCONNECT "disconnect" /* audio_devices_t */
-
-/* Query supported formats. The response is a '|' separated list of strings from
- * audio_format_t enum e.g: "sup_formats=AUDIO_FORMAT_PCM_16_BIT" */
-#define AUDIO_PARAMETER_STREAM_SUP_FORMATS "sup_formats"
-/* Query supported channel masks. The response is a '|' separated list of strings from
- * audio_channel_mask_t enum e.g: "sup_channels=AUDIO_CHANNEL_OUT_STEREO|AUDIO_CHANNEL_OUT_MONO" */
-#define AUDIO_PARAMETER_STREAM_SUP_CHANNELS "sup_channels"
-/* Query supported sampling rates. The response is a '|' separated list of integer values e.g:
- * "sup_sampling_rates=44100|48000" */
-#define AUDIO_PARAMETER_STREAM_SUP_SAMPLING_RATES "sup_sampling_rates"
-
-/* Set the HW synchronization source for an output stream. */
-#define AUDIO_PARAMETER_STREAM_HW_AV_SYNC "hw_av_sync"
-
-/* Enable mono audio playback if 1, else should be 0. */
-#define AUDIO_PARAMETER_MONO_OUTPUT "mono_output"
-
-/**
- * audio codec parameters
- */
-
-#define AUDIO_OFFLOAD_CODEC_PARAMS "music_offload_codec_param"
-#define AUDIO_OFFLOAD_CODEC_BIT_PER_SAMPLE "music_offload_bit_per_sample"
-#define AUDIO_OFFLOAD_CODEC_BIT_RATE "music_offload_bit_rate"
-#define AUDIO_OFFLOAD_CODEC_AVG_BIT_RATE "music_offload_avg_bit_rate"
-#define AUDIO_OFFLOAD_CODEC_ID "music_offload_codec_id"
-#define AUDIO_OFFLOAD_CODEC_BLOCK_ALIGN "music_offload_block_align"
-#define AUDIO_OFFLOAD_CODEC_SAMPLE_RATE "music_offload_sample_rate"
-#define AUDIO_OFFLOAD_CODEC_ENCODE_OPTION "music_offload_encode_option"
-#define AUDIO_OFFLOAD_CODEC_NUM_CHANNEL "music_offload_num_channels"
-#define AUDIO_OFFLOAD_CODEC_DOWN_SAMPLING "music_offload_down_sampling"
-#define AUDIO_OFFLOAD_CODEC_DELAY_SAMPLES "delay_samples"
-#define AUDIO_OFFLOAD_CODEC_PADDING_SAMPLES "padding_samples"
+/* Enable AANC */
+#define AUDIO_PARAMETER_KEY_AANC "aanc_enabled"
/**************************************/
@@ -399,6 +333,65 @@
int (*get_presentation_position)(const struct audio_stream_out *stream,
uint64_t *frames, struct timespec *timestamp);
+ /**
+ * Called by the framework to start a stream operating in mmap mode.
+ * create_mmap_buffer must be called before calling start()
+ *
+ * \note Function only implemented by streams operating in mmap mode.
+ *
+ * \param[in] stream the stream object.
+ * \return 0 in case of success.
+ * -ENOSYS if called out of sequence or on non mmap stream
+ */
+ int (*start)(const struct audio_stream_out* stream);
+
+ /**
+ * Called by the framework to stop a stream operating in mmap mode.
+ * Must be called after start()
+ *
+ * \note Function only implemented by streams operating in mmap mode.
+ *
+ * \param[in] stream the stream object.
+ * \return 0 in case of success.
+ * -ENOSYS if called out of sequence or on non mmap stream
+ */
+ int (*stop)(const struct audio_stream_out* stream);
+
+ /**
+ * Called by the framework to retrieve information on the mmap buffer used for audio
+ * samples transfer.
+ *
+ * \note Function only implemented by streams operating in mmap mode.
+ *
+ * \param[in] stream the stream object.
+ * \param[in] min_size_frames minimum buffer size requested. The actual buffer
+ * size returned in struct audio_mmap_buffer_info can be larger.
+ * \param[out] info address at which the mmap buffer information should be returned.
+ *
+ * \return 0 if the buffer was allocated.
+ * -ENODEV in case of initialization error
+ * -EINVAL if the requested buffer size is too large
+ * -ENOSYS if called out of sequence (e.g. buffer already allocated)
+ */
+ int (*create_mmap_buffer)(const struct audio_stream_out *stream,
+ int32_t min_size_frames,
+ struct audio_mmap_buffer_info *info);
+
+ /**
+ * Called by the framework to read current read/write position in the mmap buffer
+ * with associated time stamp.
+ *
+ * \note Function only implemented by streams operating in mmap mode.
+ *
+ * \param[in] stream the stream object.
+ * \param[out] position address at which the mmap read/write position should be returned.
+ *
+ * \return 0 if the position is successfully returned.
+ * -ENODATA if the position cannot be retrieved
+ * -ENOSYS if called before create_mmap_buffer()
+ */
+ int (*get_mmap_position)(const struct audio_stream_out *stream,
+ struct audio_mmap_position *position);
};
typedef struct audio_stream_out audio_stream_out_t;
@@ -449,6 +442,65 @@
*/
int (*get_capture_position)(const struct audio_stream_in *stream,
int64_t *frames, int64_t *time);
+
+ /**
+ * Called by the framework to start a stream operating in mmap mode.
+ * create_mmap_buffer must be called before calling start()
+ *
+ * \note Function only implemented by streams operating in mmap mode.
+ *
+ * \param[in] stream the stream object.
+ * \return 0 in case off success.
+ * -ENOSYS if called out of sequence or on non mmap stream
+ */
+ int (*start)(const struct audio_stream_in* stream);
+
+ /**
+ * Called by the framework to stop a stream operating in mmap mode.
+ *
+ * \note Function only implemented by streams operating in mmap mode.
+ *
+ * \param[in] stream the stream object.
+ * \return 0 in case of success.
+ * -ENOSYS if called out of sequence or on non mmap stream
+ */
+ int (*stop)(const struct audio_stream_in* stream);
+
+ /**
+ * Called by the framework to retrieve information on the mmap buffer used for audio
+ * samples transfer.
+ *
+ * \note Function only implemented by streams operating in mmap mode.
+ *
+ * \param[in] stream the stream object.
+ * \param[in] min_size_frames minimum buffer size requested. The actual buffer
+ * size returned in struct audio_mmap_buffer_info can be larger.
+ * \param[out] info address at which the mmap buffer information should be returned.
+ *
+ * \return 0 if the buffer was allocated.
+ * -ENODEV in case of initialization error
+ * -EINVAL if the requested buffer size is too large
+ * -ENOSYS if called out of sequence (e.g. buffer already allocated)
+ */
+ int (*create_mmap_buffer)(const struct audio_stream_in *stream,
+ int32_t min_size_frames,
+ struct audio_mmap_buffer_info *info);
+
+ /**
+ * Called by the framework to read current read/write position in the mmap buffer
+ * with associated time stamp.
+ *
+ * \note Function only implemented by streams operating in mmap mode.
+ *
+ * \param[in] stream the stream object.
+ * \param[out] position address at which the mmap read/write position should be returned.
+ *
+ * \return 0 if the position is successfully returned.
+ * -ENODATA if the position cannot be retreived
+ * -ENOSYS if called before mmap_read_position()
+ */
+ int (*get_mmap_position)(const struct audio_stream_in *stream,
+ struct audio_mmap_position *position);
};
typedef struct audio_stream_in audio_stream_in_t;
diff --git a/include/hardware/audio_effect.h b/include/hardware/audio_effect.h
index 8a88414..3366e17 100644
--- a/include/hardware/audio_effect.h
+++ b/include/hardware/audio_effect.h
@@ -26,7 +26,7 @@
#include <cutils/bitops.h>
-#include <system/audio.h>
+#include <system/audio_effect.h>
__BEGIN_DECLS
@@ -36,231 +36,11 @@
// Common Definitions
/////////////////////////////////////////////////
-//
-//--- Effect descriptor structure effect_descriptor_t
-//
-
-// Unique effect ID (can be generated from the following site:
-// http://www.itu.int/ITU-T/asn1/uuid.html)
-// This format is used for both "type" and "uuid" fields of the effect descriptor structure.
-// - When used for effect type and the engine is implementing and effect corresponding to a standard
-// OpenSL ES interface, this ID must be the one defined in OpenSLES_IID.h for that interface.
-// - When used as uuid, it should be a unique UUID for this particular implementation.
-typedef struct effect_uuid_s {
- uint32_t timeLow;
- uint16_t timeMid;
- uint16_t timeHiAndVersion;
- uint16_t clockSeq;
- uint8_t node[6];
-} effect_uuid_t;
-
-// Maximum length of character strings in structures defines by this API.
-#define EFFECT_STRING_LEN_MAX 64
-
-// NULL UUID definition (matches SL_IID_NULL_)
-#define EFFECT_UUID_INITIALIZER { 0xec7178ec, 0xe5e1, 0x4432, 0xa3f4, \
- { 0x46, 0x57, 0xe6, 0x79, 0x52, 0x10 } }
-static const effect_uuid_t EFFECT_UUID_NULL_ = EFFECT_UUID_INITIALIZER;
-static const effect_uuid_t * const EFFECT_UUID_NULL = &EFFECT_UUID_NULL_;
-static const char * const EFFECT_UUID_NULL_STR = "ec7178ec-e5e1-4432-a3f4-4657e6795210";
-
-
-// The effect descriptor contains necessary information to facilitate the enumeration of the effect
-// engines present in a library.
-typedef struct effect_descriptor_s {
- effect_uuid_t type; // UUID of to the OpenSL ES interface implemented by this effect
- effect_uuid_t uuid; // UUID for this particular implementation
- uint32_t apiVersion; // Version of the effect control API implemented
- uint32_t flags; // effect engine capabilities/requirements flags (see below)
- uint16_t cpuLoad; // CPU load indication (see below)
- uint16_t memoryUsage; // Data Memory usage (see below)
- char name[EFFECT_STRING_LEN_MAX]; // human readable effect name
- char implementor[EFFECT_STRING_LEN_MAX]; // human readable effect implementor name
-} effect_descriptor_t;
-
-// CPU load and memory usage indication: each effect implementation must provide an indication of
-// its CPU and memory usage for the audio effect framework to limit the number of effects
-// instantiated at a given time on a given platform.
-// The CPU load is expressed in 0.1 MIPS units as estimated on an ARM9E core (ARMv5TE) with 0 WS.
-// The memory usage is expressed in KB and includes only dynamically allocated memory
-
-// Definitions for flags field of effect descriptor.
-// +---------------------------+-----------+-----------------------------------
-// | description | bits | values
-// +---------------------------+-----------+-----------------------------------
-// | connection mode | 0..2 | 0 insert: after track process
-// | | | 1 auxiliary: connect to track auxiliary
-// | | | output and use send level
-// | | | 2 replace: replaces track process function;
-// | | | must implement SRC, volume and mono to stereo.
-// | | | 3 pre processing: applied below audio HAL on input
-// | | | 4 post processing: applied below audio HAL on output
-// | | | 5 - 7 reserved
-// +---------------------------+-----------+-----------------------------------
-// | insertion preference | 3..5 | 0 none
-// | | | 1 first of the chain
-// | | | 2 last of the chain
-// | | | 3 exclusive (only effect in the insert chain)
-// | | | 4..7 reserved
-// +---------------------------+-----------+-----------------------------------
-// | Volume management | 6..8 | 0 none
-// | | | 1 implements volume control
-// | | | 2 requires volume indication
-// | | | 4 reserved
-// +---------------------------+-----------+-----------------------------------
-// | Device indication | 9..11 | 0 none
-// | | | 1 requires device updates
-// | | | 2, 4 reserved
-// +---------------------------+-----------+-----------------------------------
-// | Sample input mode | 12..13 | 1 direct: process() function or EFFECT_CMD_SET_CONFIG
-// | | | command must specify a buffer descriptor
-// | | | 2 provider: process() function uses the
-// | | | bufferProvider indicated by the
-// | | | EFFECT_CMD_SET_CONFIG command to request input.
-// | | | buffers.
-// | | | 3 both: both input modes are supported
-// +---------------------------+-----------+-----------------------------------
-// | Sample output mode | 14..15 | 1 direct: process() function or EFFECT_CMD_SET_CONFIG
-// | | | command must specify a buffer descriptor
-// | | | 2 provider: process() function uses the
-// | | | bufferProvider indicated by the
-// | | | EFFECT_CMD_SET_CONFIG command to request output
-// | | | buffers.
-// | | | 3 both: both output modes are supported
-// +---------------------------+-----------+-----------------------------------
-// | Hardware acceleration | 16..17 | 0 No hardware acceleration
-// | | | 1 non tunneled hw acceleration: the process() function
-// | | | reads the samples, send them to HW accelerated
-// | | | effect processor, reads back the processed samples
-// | | | and returns them to the output buffer.
-// | | | 2 tunneled hw acceleration: the process() function is
-// | | | transparent. The effect interface is only used to
-// | | | control the effect engine. This mode is relevant for
-// | | | global effects actually applied by the audio
-// | | | hardware on the output stream.
-// +---------------------------+-----------+-----------------------------------
-// | Audio Mode indication | 18..19 | 0 none
-// | | | 1 requires audio mode updates
-// | | | 2..3 reserved
-// +---------------------------+-----------+-----------------------------------
-// | Audio source indication | 20..21 | 0 none
-// | | | 1 requires audio source updates
-// | | | 2..3 reserved
-// +---------------------------+-----------+-----------------------------------
-// | Effect offload supported | 22 | 0 The effect cannot be offloaded to an audio DSP
-// | | | 1 The effect can be offloaded to an audio DSP
-// +---------------------------+-----------+-----------------------------------
-// | Process function not | 23 | 0 The effect implements a process function.
-// | implemented | | 1 The effect does not implement a process function:
-// | | | enabling the effect has no impact on latency or
-// | | | CPU load.
-// | | | Effect implementations setting this flag do not have
-// | | | to implement a process function.
-// +---------------------------+-----------+-----------------------------------
-
-// Insert mode
-#define EFFECT_FLAG_TYPE_SHIFT 0
-#define EFFECT_FLAG_TYPE_SIZE 3
-#define EFFECT_FLAG_TYPE_MASK (((1 << EFFECT_FLAG_TYPE_SIZE) -1) \
- << EFFECT_FLAG_TYPE_SHIFT)
-#define EFFECT_FLAG_TYPE_INSERT (0 << EFFECT_FLAG_TYPE_SHIFT)
-#define EFFECT_FLAG_TYPE_AUXILIARY (1 << EFFECT_FLAG_TYPE_SHIFT)
-#define EFFECT_FLAG_TYPE_REPLACE (2 << EFFECT_FLAG_TYPE_SHIFT)
-#define EFFECT_FLAG_TYPE_PRE_PROC (3 << EFFECT_FLAG_TYPE_SHIFT)
-#define EFFECT_FLAG_TYPE_POST_PROC (4 << EFFECT_FLAG_TYPE_SHIFT)
-
-// Insert preference
-#define EFFECT_FLAG_INSERT_SHIFT (EFFECT_FLAG_TYPE_SHIFT + EFFECT_FLAG_TYPE_SIZE)
-#define EFFECT_FLAG_INSERT_SIZE 3
-#define EFFECT_FLAG_INSERT_MASK (((1 << EFFECT_FLAG_INSERT_SIZE) -1) \
- << EFFECT_FLAG_INSERT_SHIFT)
-#define EFFECT_FLAG_INSERT_ANY (0 << EFFECT_FLAG_INSERT_SHIFT)
-#define EFFECT_FLAG_INSERT_FIRST (1 << EFFECT_FLAG_INSERT_SHIFT)
-#define EFFECT_FLAG_INSERT_LAST (2 << EFFECT_FLAG_INSERT_SHIFT)
-#define EFFECT_FLAG_INSERT_EXCLUSIVE (3 << EFFECT_FLAG_INSERT_SHIFT)
-
-
-// Volume control
-#define EFFECT_FLAG_VOLUME_SHIFT (EFFECT_FLAG_INSERT_SHIFT + EFFECT_FLAG_INSERT_SIZE)
-#define EFFECT_FLAG_VOLUME_SIZE 3
-#define EFFECT_FLAG_VOLUME_MASK (((1 << EFFECT_FLAG_VOLUME_SIZE) -1) \
- << EFFECT_FLAG_VOLUME_SHIFT)
-#define EFFECT_FLAG_VOLUME_CTRL (1 << EFFECT_FLAG_VOLUME_SHIFT)
-#define EFFECT_FLAG_VOLUME_IND (2 << EFFECT_FLAG_VOLUME_SHIFT)
-#define EFFECT_FLAG_VOLUME_NONE (0 << EFFECT_FLAG_VOLUME_SHIFT)
-
-// Device indication
-#define EFFECT_FLAG_DEVICE_SHIFT (EFFECT_FLAG_VOLUME_SHIFT + EFFECT_FLAG_VOLUME_SIZE)
-#define EFFECT_FLAG_DEVICE_SIZE 3
-#define EFFECT_FLAG_DEVICE_MASK (((1 << EFFECT_FLAG_DEVICE_SIZE) -1) \
- << EFFECT_FLAG_DEVICE_SHIFT)
-#define EFFECT_FLAG_DEVICE_IND (1 << EFFECT_FLAG_DEVICE_SHIFT)
-#define EFFECT_FLAG_DEVICE_NONE (0 << EFFECT_FLAG_DEVICE_SHIFT)
-
-// Sample input modes
-#define EFFECT_FLAG_INPUT_SHIFT (EFFECT_FLAG_DEVICE_SHIFT + EFFECT_FLAG_DEVICE_SIZE)
-#define EFFECT_FLAG_INPUT_SIZE 2
-#define EFFECT_FLAG_INPUT_MASK (((1 << EFFECT_FLAG_INPUT_SIZE) -1) \
- << EFFECT_FLAG_INPUT_SHIFT)
-#define EFFECT_FLAG_INPUT_DIRECT (1 << EFFECT_FLAG_INPUT_SHIFT)
-#define EFFECT_FLAG_INPUT_PROVIDER (2 << EFFECT_FLAG_INPUT_SHIFT)
-#define EFFECT_FLAG_INPUT_BOTH (3 << EFFECT_FLAG_INPUT_SHIFT)
-
-// Sample output modes
-#define EFFECT_FLAG_OUTPUT_SHIFT (EFFECT_FLAG_INPUT_SHIFT + EFFECT_FLAG_INPUT_SIZE)
-#define EFFECT_FLAG_OUTPUT_SIZE 2
-#define EFFECT_FLAG_OUTPUT_MASK (((1 << EFFECT_FLAG_OUTPUT_SIZE) -1) \
- << EFFECT_FLAG_OUTPUT_SHIFT)
-#define EFFECT_FLAG_OUTPUT_DIRECT (1 << EFFECT_FLAG_OUTPUT_SHIFT)
-#define EFFECT_FLAG_OUTPUT_PROVIDER (2 << EFFECT_FLAG_OUTPUT_SHIFT)
-#define EFFECT_FLAG_OUTPUT_BOTH (3 << EFFECT_FLAG_OUTPUT_SHIFT)
-
-// Hardware acceleration mode
-#define EFFECT_FLAG_HW_ACC_SHIFT (EFFECT_FLAG_OUTPUT_SHIFT + EFFECT_FLAG_OUTPUT_SIZE)
-#define EFFECT_FLAG_HW_ACC_SIZE 2
-#define EFFECT_FLAG_HW_ACC_MASK (((1 << EFFECT_FLAG_HW_ACC_SIZE) -1) \
- << EFFECT_FLAG_HW_ACC_SHIFT)
-#define EFFECT_FLAG_HW_ACC_SIMPLE (1 << EFFECT_FLAG_HW_ACC_SHIFT)
-#define EFFECT_FLAG_HW_ACC_TUNNEL (2 << EFFECT_FLAG_HW_ACC_SHIFT)
-
-// Audio mode indication
-#define EFFECT_FLAG_AUDIO_MODE_SHIFT (EFFECT_FLAG_HW_ACC_SHIFT + EFFECT_FLAG_HW_ACC_SIZE)
-#define EFFECT_FLAG_AUDIO_MODE_SIZE 2
-#define EFFECT_FLAG_AUDIO_MODE_MASK (((1 << EFFECT_FLAG_AUDIO_MODE_SIZE) -1) \
- << EFFECT_FLAG_AUDIO_MODE_SHIFT)
-#define EFFECT_FLAG_AUDIO_MODE_IND (1 << EFFECT_FLAG_AUDIO_MODE_SHIFT)
-#define EFFECT_FLAG_AUDIO_MODE_NONE (0 << EFFECT_FLAG_AUDIO_MODE_SHIFT)
-
-// Audio source indication
-#define EFFECT_FLAG_AUDIO_SOURCE_SHIFT (EFFECT_FLAG_AUDIO_MODE_SHIFT + EFFECT_FLAG_AUDIO_MODE_SIZE)
-#define EFFECT_FLAG_AUDIO_SOURCE_SIZE 2
-#define EFFECT_FLAG_AUDIO_SOURCE_MASK (((1 << EFFECT_FLAG_AUDIO_SOURCE_SIZE) -1) \
- << EFFECT_FLAG_AUDIO_SOURCE_SHIFT)
-#define EFFECT_FLAG_AUDIO_SOURCE_IND (1 << EFFECT_FLAG_AUDIO_SOURCE_SHIFT)
-#define EFFECT_FLAG_AUDIO_SOURCE_NONE (0 << EFFECT_FLAG_AUDIO_SOURCE_SHIFT)
-
-// Effect offload indication
-#define EFFECT_FLAG_OFFLOAD_SHIFT (EFFECT_FLAG_AUDIO_SOURCE_SHIFT + \
- EFFECT_FLAG_AUDIO_SOURCE_SIZE)
-#define EFFECT_FLAG_OFFLOAD_SIZE 1
-#define EFFECT_FLAG_OFFLOAD_MASK (((1 << EFFECT_FLAG_OFFLOAD_SIZE) -1) \
- << EFFECT_FLAG_OFFLOAD_SHIFT)
-#define EFFECT_FLAG_OFFLOAD_SUPPORTED (1 << EFFECT_FLAG_OFFLOAD_SHIFT)
-
-// Effect has no process indication
-#define EFFECT_FLAG_NO_PROCESS_SHIFT (EFFECT_FLAG_OFFLOAD_SHIFT + \
- EFFECT_FLAG_OFFLOAD_SIZE)
-#define EFFECT_FLAG_NO_PROCESS_SIZE 1
-#define EFFECT_FLAG_NO_PROCESS_MASK (((1 << EFFECT_FLAG_NO_PROCESS_SIZE) -1) \
- << EFFECT_FLAG_NO_PROCESS_SHIFT)
-#define EFFECT_FLAG_NO_PROCESS (1 << EFFECT_FLAG_NO_PROCESS_SHIFT)
-
#define EFFECT_MAKE_API_VERSION(M, m) (((M)<<16) | ((m) & 0xFFFF))
#define EFFECT_API_VERSION_MAJOR(v) ((v)>>16)
#define EFFECT_API_VERSION_MINOR(v) ((m) & 0xFFFF)
-
/////////////////////////////////////////////////
// Effect control interface
/////////////////////////////////////////////////
@@ -288,15 +68,6 @@
// type and return its address as effect_handle_t
typedef struct effect_interface_s **effect_handle_t;
-
-// Forward definition of type audio_buffer_t
-typedef struct audio_buffer_s audio_buffer_t;
-
-
-
-
-
-
// Effect control interface definition
struct effect_interface_s {
////////////////////////////////////////////////////////////////////////////////
@@ -428,499 +199,6 @@
audio_buffer_t *outBuffer);
};
-
-//
-//--- Standardized command codes for command() function
-//
-enum effect_command_e {
- EFFECT_CMD_INIT, // initialize effect engine
- EFFECT_CMD_SET_CONFIG, // configure effect engine (see effect_config_t)
- EFFECT_CMD_RESET, // reset effect engine
- EFFECT_CMD_ENABLE, // enable effect process
- EFFECT_CMD_DISABLE, // disable effect process
- EFFECT_CMD_SET_PARAM, // set parameter immediately (see effect_param_t)
- EFFECT_CMD_SET_PARAM_DEFERRED, // set parameter deferred
- EFFECT_CMD_SET_PARAM_COMMIT, // commit previous set parameter deferred
- EFFECT_CMD_GET_PARAM, // get parameter
- EFFECT_CMD_SET_DEVICE, // set audio device (see audio.h, audio_devices_t)
- EFFECT_CMD_SET_VOLUME, // set volume
- EFFECT_CMD_SET_AUDIO_MODE, // set the audio mode (normal, ring, ...)
- EFFECT_CMD_SET_CONFIG_REVERSE, // configure effect engine reverse stream(see effect_config_t)
- EFFECT_CMD_SET_INPUT_DEVICE, // set capture device (see audio.h, audio_devices_t)
- EFFECT_CMD_GET_CONFIG, // read effect engine configuration
- EFFECT_CMD_GET_CONFIG_REVERSE, // read configure effect engine reverse stream configuration
- EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS,// get all supported configurations for a feature.
- EFFECT_CMD_GET_FEATURE_CONFIG, // get current feature configuration
- EFFECT_CMD_SET_FEATURE_CONFIG, // set current feature configuration
- EFFECT_CMD_SET_AUDIO_SOURCE, // set the audio source (see audio.h, audio_source_t)
- EFFECT_CMD_OFFLOAD, // set if effect thread is an offload one,
- // send the ioHandle of the effect thread
- EFFECT_CMD_FIRST_PROPRIETARY = 0x10000 // first proprietary command code
-};
-
-//==================================================================================================
-// command: EFFECT_CMD_INIT
-//--------------------------------------------------------------------------------------------------
-// description:
-// Initialize effect engine: All configurations return to default
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: 0
-// data: N/A
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: sizeof(int)
-// data: status
-//==================================================================================================
-// command: EFFECT_CMD_SET_CONFIG
-//--------------------------------------------------------------------------------------------------
-// description:
-// Apply new audio parameters configurations for input and output buffers
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: sizeof(effect_config_t)
-// data: effect_config_t
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: sizeof(int)
-// data: status
-//==================================================================================================
-// command: EFFECT_CMD_RESET
-//--------------------------------------------------------------------------------------------------
-// description:
-// Reset the effect engine. Keep configuration but resets state and buffer content
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: 0
-// data: N/A
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: 0
-// data: N/A
-//==================================================================================================
-// command: EFFECT_CMD_ENABLE
-//--------------------------------------------------------------------------------------------------
-// description:
-// Enable the process. Called by the framework before the first call to process()
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: 0
-// data: N/A
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: sizeof(int)
-// data: status
-//==================================================================================================
-// command: EFFECT_CMD_DISABLE
-//--------------------------------------------------------------------------------------------------
-// description:
-// Disable the process. Called by the framework after the last call to process()
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: 0
-// data: N/A
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: sizeof(int)
-// data: status
-//==================================================================================================
-// command: EFFECT_CMD_SET_PARAM
-//--------------------------------------------------------------------------------------------------
-// description:
-// Set a parameter and apply it immediately
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: sizeof(effect_param_t) + size of param and value
-// data: effect_param_t + param + value. See effect_param_t definition below for value offset
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: sizeof(int)
-// data: status
-//==================================================================================================
-// command: EFFECT_CMD_SET_PARAM_DEFERRED
-//--------------------------------------------------------------------------------------------------
-// description:
-// Set a parameter but apply it only when receiving EFFECT_CMD_SET_PARAM_COMMIT command
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: sizeof(effect_param_t) + size of param and value
-// data: effect_param_t + param + value. See effect_param_t definition below for value offset
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: 0
-// data: N/A
-//==================================================================================================
-// command: EFFECT_CMD_SET_PARAM_COMMIT
-//--------------------------------------------------------------------------------------------------
-// description:
-// Apply all previously received EFFECT_CMD_SET_PARAM_DEFERRED commands
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: 0
-// data: N/A
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: sizeof(int)
-// data: status
-//==================================================================================================
-// command: EFFECT_CMD_GET_PARAM
-//--------------------------------------------------------------------------------------------------
-// description:
-// Get a parameter value
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: sizeof(effect_param_t) + size of param
-// data: effect_param_t + param
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: sizeof(effect_param_t) + size of param and value
-// data: effect_param_t + param + value. See effect_param_t definition below for value offset
-//==================================================================================================
-// command: EFFECT_CMD_SET_DEVICE
-//--------------------------------------------------------------------------------------------------
-// description:
-// Set the rendering device the audio output path is connected to. See audio.h, audio_devices_t
-// for device values.
-// The effect implementation must set EFFECT_FLAG_DEVICE_IND flag in its descriptor to receive this
-// command when the device changes
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: sizeof(uint32_t)
-// data: uint32_t
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: 0
-// data: N/A
-//==================================================================================================
-// command: EFFECT_CMD_SET_VOLUME
-//--------------------------------------------------------------------------------------------------
-// description:
-// Set and get volume. Used by audio framework to delegate volume control to effect engine.
-// The effect implementation must set EFFECT_FLAG_VOLUME_IND or EFFECT_FLAG_VOLUME_CTRL flag in
-// its descriptor to receive this command before every call to process() function
-// If EFFECT_FLAG_VOLUME_CTRL flag is set in the effect descriptor, the effect engine must return
-// the volume that should be applied before the effect is processed. The overall volume (the volume
-// actually applied by the effect engine multiplied by the returned value) should match the value
-// indicated in the command.
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: n * sizeof(uint32_t)
-// data: volume for each channel defined in effect_config_t for output buffer expressed in
-// 8.24 fixed point format
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: n * sizeof(uint32_t) / 0
-// data: - if EFFECT_FLAG_VOLUME_CTRL is set in effect descriptor:
-// volume for each channel defined in effect_config_t for output buffer expressed in
-// 8.24 fixed point format
-// - if EFFECT_FLAG_VOLUME_CTRL is not set in effect descriptor:
-// N/A
-// It is legal to receive a null pointer as pReplyData in which case the effect framework has
-// delegated volume control to another effect
-//==================================================================================================
-// command: EFFECT_CMD_SET_AUDIO_MODE
-//--------------------------------------------------------------------------------------------------
-// description:
-// Set the audio mode. The effect implementation must set EFFECT_FLAG_AUDIO_MODE_IND flag in its
-// descriptor to receive this command when the audio mode changes.
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: sizeof(uint32_t)
-// data: audio_mode_t
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: 0
-// data: N/A
-//==================================================================================================
-// command: EFFECT_CMD_SET_CONFIG_REVERSE
-//--------------------------------------------------------------------------------------------------
-// description:
-// Apply new audio parameters configurations for input and output buffers of reverse stream.
-// An example of reverse stream is the echo reference supplied to an Acoustic Echo Canceler.
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: sizeof(effect_config_t)
-// data: effect_config_t
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: sizeof(int)
-// data: status
-//==================================================================================================
-// command: EFFECT_CMD_SET_INPUT_DEVICE
-//--------------------------------------------------------------------------------------------------
-// description:
-// Set the capture device the audio input path is connected to. See audio.h, audio_devices_t
-// for device values.
-// The effect implementation must set EFFECT_FLAG_DEVICE_IND flag in its descriptor to receive this
-// command when the device changes
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: sizeof(uint32_t)
-// data: uint32_t
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: 0
-// data: N/A
-//==================================================================================================
-// command: EFFECT_CMD_GET_CONFIG
-//--------------------------------------------------------------------------------------------------
-// description:
-// Read audio parameters configurations for input and output buffers
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: 0
-// data: N/A
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: sizeof(effect_config_t)
-// data: effect_config_t
-//==================================================================================================
-// command: EFFECT_CMD_GET_CONFIG_REVERSE
-//--------------------------------------------------------------------------------------------------
-// description:
-// Read audio parameters configurations for input and output buffers of reverse stream
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: 0
-// data: N/A
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: sizeof(effect_config_t)
-// data: effect_config_t
-//==================================================================================================
-// command: EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS
-//--------------------------------------------------------------------------------------------------
-// description:
-// Queries for supported configurations for a particular feature (e.g. get the supported
-// combinations of main and auxiliary channels for a noise suppressor).
-// The command parameter is the feature identifier (See effect_feature_e for a list of defined
-// features) followed by the maximum number of configuration descriptor to return.
-// The reply is composed of:
-// - status (uint32_t):
-// - 0 if feature is supported
-// - -ENOSYS if the feature is not supported,
-// - -ENOMEM if the feature is supported but the total number of supported configurations
-// exceeds the maximum number indicated by the caller.
-// - total number of supported configurations (uint32_t)
-// - an array of configuration descriptors.
-// The actual number of descriptors returned must not exceed the maximum number indicated by
-// the caller.
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: 2 x sizeof(uint32_t)
-// data: effect_feature_e + maximum number of configurations to return
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: 2 x sizeof(uint32_t) + n x sizeof (<config descriptor>)
-// data: status + total number of configurations supported + array of n config descriptors
-//==================================================================================================
-// command: EFFECT_CMD_GET_FEATURE_CONFIG
-//--------------------------------------------------------------------------------------------------
-// description:
-// Retrieves current configuration for a given feature.
-// The reply status is:
-// - 0 if feature is supported
-// - -ENOSYS if the feature is not supported,
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: sizeof(uint32_t)
-// data: effect_feature_e
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: sizeof(uint32_t) + sizeof (<config descriptor>)
-// data: status + config descriptor
-//==================================================================================================
-// command: EFFECT_CMD_SET_FEATURE_CONFIG
-//--------------------------------------------------------------------------------------------------
-// description:
-// Sets current configuration for a given feature.
-// The reply status is:
-// - 0 if feature is supported
-// - -ENOSYS if the feature is not supported,
-// - -EINVAL if the configuration is invalid
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: sizeof(uint32_t) + sizeof (<config descriptor>)
-// data: effect_feature_e + config descriptor
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: sizeof(uint32_t)
-// data: status
-//==================================================================================================
-// command: EFFECT_CMD_SET_AUDIO_SOURCE
-//--------------------------------------------------------------------------------------------------
-// description:
-// Set the audio source the capture path is configured for (Camcorder, voice recognition...).
-// See audio.h, audio_source_t for values.
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: sizeof(uint32_t)
-// data: uint32_t
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: 0
-// data: N/A
-//==================================================================================================
-// command: EFFECT_CMD_OFFLOAD
-//--------------------------------------------------------------------------------------------------
-// description:
-// 1.indicate if the playback thread the effect is attached to is offloaded or not
-// 2.update the io handle of the playback thread the effect is attached to
-//--------------------------------------------------------------------------------------------------
-// command format:
-// size: sizeof(effect_offload_param_t)
-// data: effect_offload_param_t
-//--------------------------------------------------------------------------------------------------
-// reply format:
-// size: sizeof(uint32_t)
-// data: uint32_t
-//--------------------------------------------------------------------------------------------------
-// command: EFFECT_CMD_FIRST_PROPRIETARY
-//--------------------------------------------------------------------------------------------------
-// description:
-// All proprietary effect commands must use command codes above this value. The size and format of
-// command and response fields is free in this case
-//==================================================================================================
-
-
-// Audio buffer descriptor used by process(), bufferProvider() functions and buffer_config_t
-// structure. Multi-channel audio is always interleaved. The channel order is from LSB to MSB with
-// regard to the channel mask definition in audio.h, audio_channel_mask_t e.g :
-// Stereo: left, right
-// 5 point 1: front left, front right, front center, low frequency, back left, back right
-// The buffer size is expressed in frame count, a frame being composed of samples for all
-// channels at a given time. Frame size for unspecified format (AUDIO_FORMAT_OTHER) is 8 bit by
-// definition
-struct audio_buffer_s {
- size_t frameCount; // number of frames in buffer
- union {
- void* raw; // raw pointer to start of buffer
- int32_t* s32; // pointer to signed 32 bit data at start of buffer
- int16_t* s16; // pointer to signed 16 bit data at start of buffer
- uint8_t* u8; // pointer to unsigned 8 bit data at start of buffer
- };
-};
-
-// The buffer_provider_s structure contains functions that can be used
-// by the effect engine process() function to query and release input
-// or output audio buffer.
-// The getBuffer() function is called to retrieve a buffer where data
-// should read from or written to by process() function.
-// The releaseBuffer() function MUST be called when the buffer retrieved
-// with getBuffer() is not needed anymore.
-// The process function should use the buffer provider mechanism to retrieve
-// input or output buffer if the inBuffer or outBuffer passed as argument is NULL
-// and the buffer configuration (buffer_config_t) given by the EFFECT_CMD_SET_CONFIG
-// command did not specify an audio buffer.
-
-typedef int32_t (* buffer_function_t)(void *cookie, audio_buffer_t *buffer);
-
-typedef struct buffer_provider_s {
- buffer_function_t getBuffer; // retrieve next buffer
- buffer_function_t releaseBuffer; // release used buffer
- void *cookie; // for use by client of buffer provider functions
-} buffer_provider_t;
-
-
-// The buffer_config_s structure specifies the input or output audio format
-// to be used by the effect engine. It is part of the effect_config_t
-// structure that defines both input and output buffer configurations and is
-// passed by the EFFECT_CMD_SET_CONFIG or EFFECT_CMD_SET_CONFIG_REVERSE command.
-typedef struct buffer_config_s {
- audio_buffer_t buffer; // buffer for use by process() function if not passed explicitly
- uint32_t samplingRate; // sampling rate
- uint32_t channels; // channel mask (see audio_channel_mask_t in audio.h)
- buffer_provider_t bufferProvider; // buffer provider
- uint8_t format; // Audio format (see audio_format_t in audio.h)
- uint8_t accessMode; // read/write or accumulate in buffer (effect_buffer_access_e)
- uint16_t mask; // indicates which of the above fields is valid
-} buffer_config_t;
-
-// Values for "accessMode" field of buffer_config_t:
-// overwrite, read only, accumulate (read/modify/write)
-enum effect_buffer_access_e {
- EFFECT_BUFFER_ACCESS_WRITE,
- EFFECT_BUFFER_ACCESS_READ,
- EFFECT_BUFFER_ACCESS_ACCUMULATE
-
-};
-
-// feature identifiers for EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS command
-enum effect_feature_e {
- EFFECT_FEATURE_AUX_CHANNELS, // supports auxiliary channels (e.g. dual mic noise suppressor)
- EFFECT_FEATURE_CNT
-};
-
-// EFFECT_FEATURE_AUX_CHANNELS feature configuration descriptor. Describe a combination
-// of main and auxiliary channels supported
-typedef struct channel_config_s {
- audio_channel_mask_t main_channels; // channel mask for main channels
- audio_channel_mask_t aux_channels; // channel mask for auxiliary channels
-} channel_config_t;
-
-
-// Values for bit field "mask" in buffer_config_t. If a bit is set, the corresponding field
-// in buffer_config_t must be taken into account when executing the EFFECT_CMD_SET_CONFIG command
-#define EFFECT_CONFIG_BUFFER 0x0001 // buffer field must be taken into account
-#define EFFECT_CONFIG_SMP_RATE 0x0002 // samplingRate field must be taken into account
-#define EFFECT_CONFIG_CHANNELS 0x0004 // channels field must be taken into account
-#define EFFECT_CONFIG_FORMAT 0x0008 // format field must be taken into account
-#define EFFECT_CONFIG_ACC_MODE 0x0010 // accessMode field must be taken into account
-#define EFFECT_CONFIG_PROVIDER 0x0020 // bufferProvider field must be taken into account
-#define EFFECT_CONFIG_ALL (EFFECT_CONFIG_BUFFER | EFFECT_CONFIG_SMP_RATE | \
- EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT | \
- EFFECT_CONFIG_ACC_MODE | EFFECT_CONFIG_PROVIDER)
-
-
-// effect_config_s structure describes the format of the pCmdData argument of EFFECT_CMD_SET_CONFIG
-// command to configure audio parameters and buffers for effect engine input and output.
-typedef struct effect_config_s {
- buffer_config_t inputCfg;
- buffer_config_t outputCfg;
-} effect_config_t;
-
-
-// effect_param_s structure describes the format of the pCmdData argument of EFFECT_CMD_SET_PARAM
-// command and pCmdData and pReplyData of EFFECT_CMD_GET_PARAM command.
-// psize and vsize represent the actual size of parameter and value.
-//
-// NOTE: the start of value field inside the data field is always on a 32 bit boundary:
-//
-// +-----------+
-// | status | sizeof(int)
-// +-----------+
-// | psize | sizeof(int)
-// +-----------+
-// | vsize | sizeof(int)
-// +-----------+
-// | | | |
-// ~ parameter ~ > psize |
-// | | | > ((psize - 1)/sizeof(int) + 1) * sizeof(int)
-// +-----------+ |
-// | padding | |
-// +-----------+
-// | | |
-// ~ value ~ > vsize
-// | | |
-// +-----------+
-
-typedef struct effect_param_s {
- int32_t status; // Transaction status (unused for command, used for reply)
- uint32_t psize; // Parameter size
- uint32_t vsize; // Value size
- char data[]; // Start of Parameter + Value data
-} effect_param_t;
-
-// Maximum effect_param_t size
-#define EFFECT_PARAM_SIZE_MAX 65536
-
-// structure used by EFFECT_CMD_OFFLOAD command
-typedef struct effect_offload_param_s {
- bool isOffload; // true if the playback thread the effect is attached to is offloaded
- int ioHandle; // io handle of the playback thread the effect is attached to
-} effect_offload_param_t;
-
-
/////////////////////////////////////////////////
// Effect library interface
/////////////////////////////////////////////////
diff --git a/include/hardware/camera_common.h b/include/hardware/camera_common.h
index c74d7bb..7bafa88 100644
--- a/include/hardware/camera_common.h
+++ b/include/hardware/camera_common.h
@@ -143,8 +143,8 @@
#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) // DEPRECATED
#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0) // NO LONGER SUPPORTED
#define CAMERA_DEVICE_API_VERSION_2_1 HARDWARE_DEVICE_API_VERSION(2, 1) // NO LONGER SUPPORTED
-#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0)
-#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1)
+#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0) // NO LONGER SUPPORTED
+#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1) // NO LONGER SUPPORTED
#define CAMERA_DEVICE_API_VERSION_3_2 HARDWARE_DEVICE_API_VERSION(3, 2)
#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)
diff --git a/include/hardware/fingerprint.h b/include/hardware/fingerprint.h
index 618ca7e..408fabd 100644
--- a/include/hardware/fingerprint.h
+++ b/include/hardware/fingerprint.h
@@ -18,10 +18,12 @@
#define ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H
#include <hardware/hw_auth_token.h>
+#include <hardware/hardware.h>
#define FINGERPRINT_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0)
#define FINGERPRINT_MODULE_API_VERSION_2_0 HARDWARE_MODULE_API_VERSION(2, 0)
#define FINGERPRINT_MODULE_API_VERSION_2_1 HARDWARE_MODULE_API_VERSION(2, 1)
+#define FINGERPRINT_MODULE_API_VERSION_3_0 HARDWARE_MODULE_API_VERSION(3, 0)
#define FINGERPRINT_HARDWARE_MODULE_ID "fingerprint"
typedef enum fingerprint_msg_type {
@@ -50,6 +52,7 @@
FINGERPRINT_ERROR_NO_SPACE = 4, /* No space available to store a template */
FINGERPRINT_ERROR_CANCELED = 5, /* The current operation can't proceed. See above. */
FINGERPRINT_ERROR_UNABLE_TO_REMOVE = 6, /* fingerprint with given id can't be removed */
+ FINGERPRINT_ERROR_LOCKOUT = 7, /* the fingerprint hardware is in lockout due to too many attempts */
FINGERPRINT_ERROR_VENDOR_BASE = 1000 /* vendor-specific error messages start here */
} fingerprint_error_t;
@@ -68,6 +71,8 @@
FINGERPRINT_ACQUIRED_IMAGER_DIRTY = 3, /* sensor needs to be cleaned */
FINGERPRINT_ACQUIRED_TOO_SLOW = 4, /* mostly swipe-type sensors; not enough data collected */
FINGERPRINT_ACQUIRED_TOO_FAST = 5, /* for swipe and area sensors; tell user to slow down*/
+ FINGERPRINT_ACQUIRED_DETECTED = 6, /* when the finger is first detected. Used to optimize wakeup.
+ Should be followed by one of the above messages */
FINGERPRINT_ACQUIRED_VENDOR_BASE = 1000 /* vendor-specific acquisition messages start here */
} fingerprint_acquired_info_t;
@@ -84,14 +89,13 @@
uint64_t msg; /* Vendor specific message. Used for user guidance */
} fingerprint_enroll_t;
-typedef struct fingerprint_enumerated {
+typedef struct fingerprint_iterator {
fingerprint_finger_id_t finger;
uint32_t remaining_templates;
-} fingerprint_enumerated_t;
+} fingerprint_iterator_t;
-typedef struct fingerprint_removed {
- fingerprint_finger_id_t finger;
-} fingerprint_removed_t;
+typedef fingerprint_iterator_t fingerprint_enumerated_t;
+typedef fingerprint_iterator_t fingerprint_removed_t;
typedef struct fingerprint_acquired {
fingerprint_acquired_info_t acquired_info; /* information about the image */
@@ -206,7 +210,7 @@
/*
* Enumerate all the fingerprint templates found in the directory set by
* set_active_group()
- * For each template found notify() will be called with:
+ * For each template found a notify() will be called with:
* fingerprint_msg.type == FINGERPRINT_TEMPLATE_ENUMERATED
* fingerprint_msg.data.enumerated.finger indicating a template id
* fingerprint_msg.data.enumerated.remaining_templates indicating how many more
@@ -221,9 +225,14 @@
* Fingerprint remove request:
* Deletes a fingerprint template.
* Works only within the path set by set_active_group().
- * notify() will be called with details on the template deleted.
- * fingerprint_msg.type == FINGERPRINT_TEMPLATE_REMOVED and
- * fingerprint_msg.data.removed.finger indicating the template id removed.
+ * The fid parameter can be used as a widcard:
+ * * fid == 0 -- delete all the templates in the group.
+ * * fid != 0 -- delete this specific template from the group.
+ * For each template found a notify() will be called with:
+ * fingerprint_msg.type == FINGERPRINT_TEMPLATE_REMOVED
+ * fingerprint_msg.data.removed.finger indicating a template id deleted
+ * fingerprint_msg.data.removed.remaining_templates indicating how many more
+ * templates will be deleted by this operation.
*
* Function return: 0 if fingerprint template(s) can be successfully deleted
* or a negative number in case of error, generally from the errno.h set.
diff --git a/include/hardware/fused_location.h b/include/hardware/fused_location.h
index 73360a1..550e193 100644
--- a/include/hardware/fused_location.h
+++ b/include/hardware/fused_location.h
@@ -19,6 +19,7 @@
#include <hardware/hardware.h>
+#include "gnss-base.h"
/**
* This header file defines the interface of the Fused Location Provider.
@@ -103,16 +104,6 @@
#define FLP_STATUS_LOCATION_UNAVAILABLE 1
/**
- * This constant is used with the batched locations
- * APIs. Batching is mandatory when FLP implementation
- * is supported. If the flag is set, the hardware implementation
- * will wake up the application processor when the FIFO is full,
- * If the flag is not set, the hardware implementation will drop
- * the oldest data when the FIFO is full.
- */
-#define FLP_BATCH_WAKEUP_ON_FIFO_FULL 0x0000001
-
-/**
* While batching, the implementation should not call the
* flp_location_callback on every location fix. However,
* sometimes in high power mode, the system might need
diff --git a/include/hardware/gnss-base.h b/include/hardware/gnss-base.h
new file mode 100644
index 0000000..e56020d
--- /dev/null
+++ b/include/hardware/gnss-base.h
@@ -0,0 +1,275 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+// Source: android.hardware.gnss@1.0
+// Root: android.hardware:hardware/interfaces
+
+#ifndef HIDL_GENERATED_ANDROID_HARDWARE_GNSS_V1_0_EXPORTED_CONSTANTS_H_
+#define HIDL_GENERATED_ANDROID_HARDWARE_GNSS_V1_0_EXPORTED_CONSTANTS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+ GNSS_MAX_SVS_COUNT = 64u, // 64
+};
+
+enum {
+ GNSS_CONSTELLATION_UNKNOWN = 0,
+ GNSS_CONSTELLATION_GPS = 1,
+ GNSS_CONSTELLATION_SBAS = 2,
+ GNSS_CONSTELLATION_GLONASS = 3,
+ GNSS_CONSTELLATION_QZSS = 4,
+ GNSS_CONSTELLATION_BEIDOU = 5,
+ GNSS_CONSTELLATION_GALILEO = 6,
+};
+
+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
+};
+
+enum {
+ APN_IP_INVALID = 0,
+ APN_IP_IPV4 = 1,
+ APN_IP_IPV6 = 2,
+ APN_IP_IPV4V6 = 3,
+};
+
+enum {
+ AGPS_TYPE_SUPL = 1,
+ AGPS_TYPE_C2K = 2,
+};
+
+enum {
+ GNSS_REQUEST_AGNSS_DATA_CONN = 1,
+ GNSS_RELEASE_AGNSS_DATA_CONN = 2,
+ GNSS_AGNSS_DATA_CONNECTED = 3,
+ GNSS_AGNSS_DATA_CONN_DONE = 4,
+ GNSS_AGNSS_DATA_CONN_FAILED = 5,
+};
+
+enum {
+ AGPS_SETID_TYPE_NONE = 0,
+ AGPS_SETID_TYPE_IMSI = 1,
+ AGPS_SETID_TYPE_MSISDM = 2,
+};
+
+enum {
+ AGPS_RIL_NETWORK_TYPE_MOBILE = 0,
+ AGPS_RIL_NETWORK_TYPE_WIFI = 1,
+ AGPS_RIL_NETWORK_TYPE_MMS = 2,
+ AGPS_RIL_NETWORK_TYPE_SUPL = 3,
+ AGPS_RIL_NETWORK_TYPE_DUN = 4,
+ AGPS_RIL_NETWORK_TYPE_HIPRI = 5,
+ AGPS_RIL_NETWORK_TYPE_WIMAX = 6,
+};
+
+enum {
+ AGPS_REF_LOCATION_TYPE_GSM_CELLID = 1,
+ AGPS_REF_LOCATION_TYPE_UMTS_CELLID = 2,
+ AGPS_REF_LOCATION_TYPE_LTE_CELLID = 4,
+};
+
+enum {
+ AGPS_RIL_REQUEST_SETID_IMSI = 1u, // (1 << 0L)
+ AGPS_RIL_REQUEST_SETID_MSISDN = 2u, // (1 << 1L)
+};
+
+enum {
+ GPS_POSITION_MODE_STANDALONE = 0,
+ GPS_POSITION_MODE_MS_BASED = 1,
+ GPS_POSITION_MODE_MS_ASSISTED = 2,
+};
+
+enum {
+ GPS_POSITION_RECURRENCE_PERIODIC = 0u, // 0
+ GPS_POSITION_RECURRENCE_SINGLE = 1u, // 1
+};
+
+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
+};
+
+enum {
+ 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)
+};
+
+enum {
+ GPS_STATUS_NONE = 0,
+ GPS_STATUS_SESSION_BEGIN = 1,
+ GPS_STATUS_SESSION_END = 2,
+ GPS_STATUS_ENGINE_ON = 3,
+ GPS_STATUS_ENGINE_OFF = 4,
+};
+
+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)
+};
+
+enum {
+ 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)
+};
+
+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)
+};
+
+enum {
+ GPS_MEASUREMENT_SUCCESS = 0,
+ 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)
+};
+
+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)
+};
+
+enum {
+ GNSS_MULTIPATH_INDICATOR_UNKNOWN = 0,
+ GNSS_MULTIPATH_INDICATOR_PRESENT = 1,
+ GNSS_MULTIPATH_INDICATIOR_NOT_PRESENT = 2,
+};
+
+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)
+};
+
+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)
+};
+
+enum {
+ GPS_NAVIGATION_MESSAGE_SUCCESS = 0,
+ 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
+};
+
+typedef enum {
+ NAV_MESSAGE_STATUS_PARITY_PASSED = 1, // (1 << 0)
+ NAV_MESSAGE_STATUS_PARITY_REBUILT = 2, // (1 << 1)
+ NAV_MESSAGE_STATUS_UNKNOWN = 0,
+} navigation_message_status;
+
+enum {
+ GPS_NI_TYPE_VOICE = 1,
+ GPS_NI_TYPE_UMTS_SUPL = 2,
+ GPS_NI_TYPE_UMTS_CTRL_PLANE = 3,
+};
+
+enum {
+ GPS_NI_NEED_NOTIFY = 1u, // 0x0001
+ GPS_NI_NEED_VERIFY = 2u, // 0x0002
+ GPS_NI_PRIVACY_OVERRIDE = 4u, // 0x0004
+};
+
+enum {
+ GPS_NI_RESPONSE_ACCEPT = 1,
+ GPS_NI_RESPONSE_DENY = 2,
+ GPS_NI_RESPONSE_NORESP = 3,
+};
+
+enum {
+ GPS_ENC_NONE = 0,
+ GPS_ENC_SUPL_GSM_DEFAULT = 1,
+ GPS_ENC_SUPL_UTF8 = 2,
+ GPS_ENC_SUPL_UCS2 = 3,
+ GPS_ENC_UNKNOWN = -1, // (-1)
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // HIDL_GENERATED_ANDROID_HARDWARE_GNSS_V1_0_EXPORTED_CONSTANTS_H_
diff --git a/include/hardware/gps.h b/include/hardware/gps.h
index acf601b..4e108b3 100644
--- a/include/hardware/gps.h
+++ b/include/hardware/gps.h
@@ -26,8 +26,42 @@
#include <hardware/hardware.h>
+#include "gnss-base.h"
+
__BEGIN_DECLS
+/*
+ * Enums defined in HIDL in hardware/interfaces are auto-generated and present
+ * in gnss-base.h.
+ */
+
+/* for compatibility */
+
+/** Maximum number of SVs for gps_sv_status_callback(). */
+#define GNSS_MAX_SVS GNSS_MAX_SVS_COUNT
+/** Maximum number of Measurements in gnss_measurement_callback(). */
+#define GNSS_MAX_MEASUREMENT GNSS_MAX_SVS_COUNT
+
+#define GPS_REQUEST_AGPS_DATA_CONN GNSS_REQUEST_AGNSS_DATA_CONN
+#define GPS_RELEASE_AGPS_DATA_CONN GNSS_RELEASE_AGNSS_DATA_CONN
+#define GPS_AGPS_DATA_CONNECTED GNSS_AGNSS_DATA_CONNECTED
+#define GPS_AGPS_DATA_CONN_DONE GNSS_AGNSS_DATA_CONN_DONE
+#define GPS_AGPS_DATA_CONN_FAILED GNSS_AGNSS_DATA_CONN_FAILED
+#define AGPS_RIL_NETWORK_TYPE_MOBILE_MMS AGPS_RIL_NETWORK_TYPE_MMS
+#define AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL AGPS_RIL_NETWORK_TYPE_SUPL
+#define AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN AGPS_RIL_NETWORK_TYPE_DUN
+#define AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI AGPS_RIL_NETWORK_TYPE_HIPRI
+#define AGPS_RIL_NETWORK_TTYPE_WIMAX AGPS_RIL_NETWORK_TYPE_WIMAX
+#define GNSS_MULTIPATH_INDICATOR_NOT_PRESENT GNSS_MULTIPATH_INDICATIOR_NOT_PRESENT
+#define AGPS_SETID_TYPE_MSISDN AGPS_SETID_TYPE_MSISDM
+#define GPS_MEASUREMENT_OPERATION_SUCCESS GPS_MEASUREMENT_SUCCESS
+#define GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS GPS_NAVIGATION_MESSAGE_SUCCESS
+#define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L1CA GNSS_NAVIGATION_MESSAGE_TYPE_GNSS_L1CA
+#define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L2CNAV GNSS_NAVIGATION_MESSAGE_TYPE_GNSS_L2CNAV
+#define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L5CNAV GNSS_NAVIGATION_MESSAGE_TYPE_GNSS_L5CNAV
+#define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_CNAV2 GNSS_NAVIGATION_MESSAGE_TYPE_GNSS_CNAV2
+#define GPS_LOCATION_HAS_ACCURACY GPS_LOCATION_HAS_HORIZONTAL_ACCURACY
+
/**
* The id of this module
*/
@@ -39,127 +73,34 @@
/** Maximum number of SVs for gps_sv_status_callback(). */
#define GPS_MAX_SVS 32
-/** Maximum number of SVs for gps_sv_status_callback(). */
-#define GNSS_MAX_SVS 64
/** Maximum number of Measurements in gps_measurement_callback(). */
#define GPS_MAX_MEASUREMENT 32
-/** Maximum number of Measurements in gnss_measurement_callback(). */
-#define GNSS_MAX_MEASUREMENT 64
-
/** Requested operational mode for GPS operation. */
typedef uint32_t GpsPositionMode;
-/* IMPORTANT: Note that the following values must match
- * constants in GpsLocationProvider.java. */
-/** Mode for running GPS standalone (no assistance). */
-#define GPS_POSITION_MODE_STANDALONE 0
-/** AGPS MS-Based mode. */
-#define GPS_POSITION_MODE_MS_BASED 1
-/**
- * AGPS MS-Assisted mode. This mode is not maintained by the platform anymore.
- * It is strongly recommended to use GPS_POSITION_MODE_MS_BASED instead.
- */
-#define GPS_POSITION_MODE_MS_ASSISTED 2
/** Requested recurrence mode for GPS operation. */
typedef uint32_t GpsPositionRecurrence;
-/* IMPORTANT: Note that the following values must match
- * constants in GpsLocationProvider.java. */
-/** Receive GPS fixes on a recurring basis at a specified period. */
-#define GPS_POSITION_RECURRENCE_PERIODIC 0
-/** Request a single shot GPS fix. */
-#define GPS_POSITION_RECURRENCE_SINGLE 1
/** GPS status event values. */
typedef uint16_t GpsStatusValue;
-/* IMPORTANT: Note that the following values must match
- * constants in GpsLocationProvider.java. */
-/** GPS status unknown. */
-#define GPS_STATUS_NONE 0
-/** GPS has begun navigating. */
-#define GPS_STATUS_SESSION_BEGIN 1
-/** GPS has stopped navigating. */
-#define GPS_STATUS_SESSION_END 2
-/** GPS has powered on but is not navigating. */
-#define GPS_STATUS_ENGINE_ON 3
-/** GPS is powered off. */
-#define GPS_STATUS_ENGINE_OFF 4
/** Flags to indicate which values are valid in a GpsLocation. */
typedef uint16_t GpsLocationFlags;
-/* IMPORTANT: Note that the following values must match
- * constants in GpsLocationProvider.java. */
-/** GpsLocation has valid latitude and longitude. */
-#define GPS_LOCATION_HAS_LAT_LONG 0x0001
-/** GpsLocation has valid altitude. */
-#define GPS_LOCATION_HAS_ALTITUDE 0x0002
-/** GpsLocation has valid speed. */
-#define GPS_LOCATION_HAS_SPEED 0x0004
-/** GpsLocation has valid bearing. */
-#define GPS_LOCATION_HAS_BEARING 0x0008
-/** GpsLocation has valid accuracy. */
-#define GPS_LOCATION_HAS_ACCURACY 0x0010
-
-/** Flags for the gps_set_capabilities callback. */
-
-/**
- * GPS HAL schedules fixes for GPS_POSITION_RECURRENCE_PERIODIC mode. If this is
- * not set, then the framework will use 1000ms for min_interval and will start
- * and call start() and stop() to schedule the GPS.
- */
-#define GPS_CAPABILITY_SCHEDULING (1 << 0)
-/** GPS supports MS-Based AGPS mode */
-#define GPS_CAPABILITY_MSB (1 << 1)
-/** GPS supports MS-Assisted AGPS mode */
-#define GPS_CAPABILITY_MSA (1 << 2)
-/** GPS supports single-shot fixes */
-#define GPS_CAPABILITY_SINGLE_SHOT (1 << 3)
-/** GPS supports on demand time injection */
-#define GPS_CAPABILITY_ON_DEMAND_TIME (1 << 4)
-/** GPS supports Geofencing */
-#define GPS_CAPABILITY_GEOFENCING (1 << 5)
-/** GPS supports Measurements. */
-#define GPS_CAPABILITY_MEASUREMENTS (1 << 6)
-/** GPS supports Navigation Messages */
-#define GPS_CAPABILITY_NAV_MESSAGES (1 << 7)
/**
* Flags used to specify which aiding data to delete when calling
* delete_aiding_data().
*/
typedef uint16_t GpsAidingData;
-/* IMPORTANT: Note that the following values must match
- * constants in GpsLocationProvider.java. */
-#define GPS_DELETE_EPHEMERIS 0x0001
-#define GPS_DELETE_ALMANAC 0x0002
-#define GPS_DELETE_POSITION 0x0004
-#define GPS_DELETE_TIME 0x0008
-#define GPS_DELETE_IONO 0x0010
-#define GPS_DELETE_UTC 0x0020
-#define GPS_DELETE_HEALTH 0x0040
-#define GPS_DELETE_SVDIR 0x0080
-#define GPS_DELETE_SVSTEER 0x0100
-#define GPS_DELETE_SADATA 0x0200
-#define GPS_DELETE_RTI 0x0400
-#define GPS_DELETE_CELLDB_INFO 0x8000
-#define GPS_DELETE_ALL 0xFFFF
/** AGPS type */
typedef uint16_t AGpsType;
-#define AGPS_TYPE_SUPL 1
-#define AGPS_TYPE_C2K 2
typedef uint16_t AGpsSetIDType;
-#define AGPS_SETID_TYPE_NONE 0
-#define AGPS_SETID_TYPE_IMSI 1
-#define AGPS_SETID_TYPE_MSISDN 2
typedef uint16_t ApnIpType;
-#define APN_IP_INVALID 0
-#define APN_IP_IPV4 1
-#define APN_IP_IPV6 2
-#define APN_IP_IPV4V6 3
/**
* String length constants
@@ -171,71 +112,31 @@
* GpsNiType constants
*/
typedef uint32_t GpsNiType;
-#define GPS_NI_TYPE_VOICE 1
-#define GPS_NI_TYPE_UMTS_SUPL 2
-#define GPS_NI_TYPE_UMTS_CTRL_PLANE 3
/**
* GpsNiNotifyFlags constants
*/
typedef uint32_t GpsNiNotifyFlags;
-/** NI requires notification */
-#define GPS_NI_NEED_NOTIFY 0x0001
-/** NI requires verification */
-#define GPS_NI_NEED_VERIFY 0x0002
-/** NI requires privacy override, no notification/minimal trace */
-#define GPS_NI_PRIVACY_OVERRIDE 0x0004
/**
* GPS NI responses, used to define the response in
* NI structures
*/
typedef int GpsUserResponseType;
-#define GPS_NI_RESPONSE_ACCEPT 1
-#define GPS_NI_RESPONSE_DENY 2
-#define GPS_NI_RESPONSE_NORESP 3
/**
* NI data encoding scheme
*/
typedef int GpsNiEncodingType;
-#define GPS_ENC_NONE 0
-#define GPS_ENC_SUPL_GSM_DEFAULT 1
-#define GPS_ENC_SUPL_UTF8 2
-#define GPS_ENC_SUPL_UCS2 3
-#define GPS_ENC_UNKNOWN -1
/** AGPS status event values. */
typedef uint16_t AGpsStatusValue;
-/** GPS requests data connection for AGPS. */
-#define GPS_REQUEST_AGPS_DATA_CONN 1
-/** GPS releases the AGPS data connection. */
-#define GPS_RELEASE_AGPS_DATA_CONN 2
-/** AGPS data connection initiated */
-#define GPS_AGPS_DATA_CONNECTED 3
-/** AGPS data connection completed */
-#define GPS_AGPS_DATA_CONN_DONE 4
-/** AGPS data connection failed */
-#define GPS_AGPS_DATA_CONN_FAILED 5
typedef uint16_t AGpsRefLocationType;
-#define AGPS_REF_LOCATION_TYPE_GSM_CELLID 1
-#define AGPS_REF_LOCATION_TYPE_UMTS_CELLID 2
-#define AGPS_REF_LOCATION_TYPE_MAC 3
-#define AGPS_REF_LOCATION_TYPE_LTE_CELLID 4
/* Deprecated, to be removed in the next Android release. */
#define AGPS_REG_LOCATION_TYPE_MAC 3
-/** Network types for update_network_state "type" parameter */
-#define AGPS_RIL_NETWORK_TYPE_MOBILE 0
-#define AGPS_RIL_NETWORK_TYPE_WIFI 1
-#define AGPS_RIL_NETWORK_TYPE_MOBILE_MMS 2
-#define AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL 3
-#define AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN 4
-#define AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI 5
-#define AGPS_RIL_NETWORK_TTYPE_WIMAX 6
-
/* The following typedef together with its constants below are deprecated, and
* will be removed in the next release. */
typedef uint16_t GpsClockFlags;
@@ -251,20 +152,6 @@
* Flags to indicate what fields in GnssClock are valid.
*/
typedef uint16_t GnssClockFlags;
-/** A valid 'leap second' is stored in the data structure. */
-#define GNSS_CLOCK_HAS_LEAP_SECOND (1<<0)
-/** A valid 'time uncertainty' is stored in the data structure. */
-#define GNSS_CLOCK_HAS_TIME_UNCERTAINTY (1<<1)
-/** A valid 'full bias' is stored in the data structure. */
-#define GNSS_CLOCK_HAS_FULL_BIAS (1<<2)
-/** A valid 'bias' is stored in the data structure. */
-#define GNSS_CLOCK_HAS_BIAS (1<<3)
-/** A valid 'bias uncertainty' is stored in the data structure. */
-#define GNSS_CLOCK_HAS_BIAS_UNCERTAINTY (1<<4)
-/** A valid 'drift' is stored in the data structure. */
-#define GNSS_CLOCK_HAS_DRIFT (1<<5)
-/** A valid 'drift uncertainty' is stored in the data structure. */
-#define GNSS_CLOCK_HAS_DRIFT_UNCERTAINTY (1<<6)
/* The following typedef together with its constants below are deprecated, and
* will be removed in the next release. */
@@ -300,16 +187,6 @@
* Flags to indicate what fields in GnssMeasurement are valid.
*/
typedef uint32_t GnssMeasurementFlags;
-/** A valid 'snr' is stored in the data structure. */
-#define GNSS_MEASUREMENT_HAS_SNR (1<<0)
-/** A valid 'carrier frequency' is stored in the data structure. */
-#define GNSS_MEASUREMENT_HAS_CARRIER_FREQUENCY (1<<9)
-/** A valid 'carrier cycles' is stored in the data structure. */
-#define GNSS_MEASUREMENT_HAS_CARRIER_CYCLES (1<<10)
-/** A valid 'carrier phase' is stored in the data structure. */
-#define GNSS_MEASUREMENT_HAS_CARRIER_PHASE (1<<11)
-/** A valid 'carrier phase uncertainty' is stored in the data structure. */
-#define GNSS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY (1<<12)
/* The following typedef together with its constants below are deprecated, and
* will be removed in the next release. */
@@ -331,12 +208,6 @@
* indicator.
*/
typedef uint8_t GnssMultipathIndicator;
-/** The indicator is not available or unknown. */
-#define GNSS_MULTIPATH_INDICATOR_UNKNOWN 0
-/** The measurement is indicated to be affected by multipath. */
-#define GNSS_MULTIPATH_INDICATOR_PRESENT 1
-/** The measurement is indicated to be not affected by multipath. */
-#define GNSS_MULTIPATH_INDICATOR_NOT_PRESENT 2
/* The following typedef together with its constants below are deprecated, and
* will be removed in the next release. */
@@ -363,21 +234,6 @@
* set to GNSS_MEASUREMENT_STATE_UNKNOWN(0).
*/
typedef uint32_t GnssMeasurementState;
-#define GNSS_MEASUREMENT_STATE_UNKNOWN 0
-#define GNSS_MEASUREMENT_STATE_CODE_LOCK (1<<0)
-#define GNSS_MEASUREMENT_STATE_BIT_SYNC (1<<1)
-#define GNSS_MEASUREMENT_STATE_SUBFRAME_SYNC (1<<2)
-#define GNSS_MEASUREMENT_STATE_TOW_DECODED (1<<3)
-#define GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS (1<<4)
-#define GNSS_MEASUREMENT_STATE_SYMBOL_SYNC (1<<5)
-#define GNSS_MEASUREMENT_STATE_GLO_STRING_SYNC (1<<6)
-#define GNSS_MEASUREMENT_STATE_GLO_TOD_DECODED (1<<7)
-#define GNSS_MEASUREMENT_STATE_BDS_D2_BIT_SYNC (1<<8)
-#define GNSS_MEASUREMENT_STATE_BDS_D2_SUBFRAME_SYNC (1<<9)
-#define GNSS_MEASUREMENT_STATE_GAL_E1BC_CODE_LOCK (1<<10)
-#define GNSS_MEASUREMENT_STATE_GAL_E1C_2ND_CODE_LOCK (1<<11)
-#define GNSS_MEASUREMENT_STATE_GAL_E1B_PAGE_SYNC (1<<12)
-#define GNSS_MEASUREMENT_STATE_SBAS_SYNC (1<<13)
/* The following typedef together with its constants below are deprecated, and
* will be removed in the next release. */
@@ -391,10 +247,6 @@
* Flags indicating the Accumulated Delta Range's states.
*/
typedef uint16_t GnssAccumulatedDeltaRangeState;
-#define GNSS_ADR_STATE_UNKNOWN 0
-#define GNSS_ADR_STATE_VALID (1<<0)
-#define GNSS_ADR_STATE_RESET (1<<1)
-#define GNSS_ADR_STATE_CYCLE_SLIP (1<<2)
/* The following typedef together with its constants below are deprecated, and
* will be removed in the next release. */
@@ -414,26 +266,6 @@
*/
typedef int16_t GnssNavigationMessageType;
-#define GNSS_NAVIGATION_MESSAGE_TYPE_UNKNOWN 0
-/** GPS L1 C/A message contained in the structure. */
-#define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L1CA 0x0101
-/** GPS L2-CNAV message contained in the structure. */
-#define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L2CNAV 0x0102
-/** GPS L5-CNAV message contained in the structure. */
-#define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L5CNAV 0x0103
-/** GPS CNAV-2 message contained in the structure. */
-#define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_CNAV2 0x0104
-/** Glonass L1 CA message contained in the structure. */
-#define GNSS_NAVIGATION_MESSAGE_TYPE_GLO_L1CA 0x0301
-/** Beidou D1 message contained in the structure. */
-#define GNSS_NAVIGATION_MESSAGE_TYPE_BDS_D1 0x0501
-/** Beidou D2 message contained in the structure. */
-#define GNSS_NAVIGATION_MESSAGE_TYPE_BDS_D2 0x0502
-/** Galileo I/NAV message contained in the structure. */
-#define GNSS_NAVIGATION_MESSAGE_TYPE_GAL_I 0x0601
-/** Galileo F/NAV message contained in the structure. */
-#define GNSS_NAVIGATION_MESSAGE_TYPE_GAL_F 0x0602
-
/**
* Status of Navigation Message
* When a message is received properly without any parity error in its navigation words, the
@@ -444,9 +276,6 @@
* corrected.
*/
typedef uint16_t NavigationMessageStatus;
-#define NAV_MESSAGE_STATUS_UNKNOWN 0
-#define NAV_MESSAGE_STATUS_PARITY_PASSED (1<<0)
-#define NAV_MESSAGE_STATUS_PARITY_REBUILT (1<<1)
/* This constant is deprecated, and will be removed in the next release. */
#define NAV_MESSAGE_STATUS_UNKONW 0
@@ -455,22 +284,11 @@
* Flags that indicate information about the satellite
*/
typedef uint8_t GnssSvFlags;
-#define GNSS_SV_FLAGS_NONE 0
-#define GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA (1 << 0)
-#define GNSS_SV_FLAGS_HAS_ALMANAC_DATA (1 << 1)
-#define GNSS_SV_FLAGS_USED_IN_FIX (1 << 2)
/**
* Constellation type of GnssSvInfo
*/
typedef uint8_t GnssConstellationType;
-#define GNSS_CONSTELLATION_UNKNOWN 0
-#define GNSS_CONSTELLATION_GPS 1
-#define GNSS_CONSTELLATION_SBAS 2
-#define GNSS_CONSTELLATION_GLONASS 3
-#define GNSS_CONSTELLATION_QZSS 4
-#define GNSS_CONSTELLATION_BEIDOU 5
-#define GNSS_CONSTELLATION_GALILEO 6
/**
* Name for the GPS XTRA interface.
@@ -522,7 +340,6 @@
*/
#define GNSS_CONFIGURATION_INTERFACE "gnss_configuration"
-
/** Represents a location. */
typedef struct {
/** set to sizeof(GpsLocation) */
@@ -1126,9 +943,6 @@
const GpsInterface* (*get_gps_interface)(struct gps_device_t* dev);
};
-#define AGPS_RIL_REQUEST_SETID_IMSI (1<<0L)
-#define AGPS_RIL_REQUEST_SETID_MSISDN (1<<1L)
-
#define AGPS_RIL_REQUEST_REFLOC_CELLID (1<<0L)
#define AGPS_RIL_REQUEST_REFLOC_MAC (1<<1L)
@@ -1251,19 +1065,6 @@
* subsystem knows about the Geofence.
*
*/
-#define GPS_GEOFENCE_ENTERED (1<<0L)
-#define GPS_GEOFENCE_EXITED (1<<1L)
-#define GPS_GEOFENCE_UNCERTAIN (1<<2L)
-
-#define GPS_GEOFENCE_UNAVAILABLE (1<<0L)
-#define GPS_GEOFENCE_AVAILABLE (1<<1L)
-
-#define GPS_GEOFENCE_OPERATION_SUCCESS 0
-#define GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES -100
-#define GPS_GEOFENCE_ERROR_ID_EXISTS -101
-#define GPS_GEOFENCE_ERROR_ID_UNKNOWN -102
-#define GPS_GEOFENCE_ERROR_INVALID_TRANSITION -103
-#define GPS_GEOFENCE_ERROR_GENERIC -149
/**
* The callback associated with the geofence.
@@ -1972,10 +1773,6 @@
gnss_measurement_callback gnss_measurement_callback;
} GpsMeasurementCallbacks;
-#define GPS_MEASUREMENT_OPERATION_SUCCESS 0
-#define GPS_MEASUREMENT_ERROR_ALREADY_INIT -100
-#define GPS_MEASUREMENT_ERROR_GENERIC -101
-
/**
* Extended interface for GPS Measurements support.
*/
@@ -2147,10 +1944,6 @@
gnss_navigation_message_callback gnss_navigation_message_callback;
} GpsNavigationMessageCallbacks;
-#define GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS 0
-#define GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT -100
-#define GPS_NAVIGATION_MESSAGE_ERROR_GENERIC -101
-
/**
* Extended interface for GPS navigation message reporting support.
*/
diff --git a/include/hardware/gralloc1.h b/include/hardware/gralloc1.h
index a1a2d69..e97126e 100644
--- a/include/hardware/gralloc1.h
+++ b/include/hardware/gralloc1.h
@@ -36,7 +36,10 @@
* allocate may be NULL, which instructs the device to report whether the
* given allocation is possible or not. */
GRALLOC1_CAPABILITY_TEST_ALLOCATE = 1,
- GRALLOC1_LAST_CAPABILITY = 1,
+ /* If this capability is supported, then the implementation supports
+ * allocating buffers with more than one image layer. */
+ GRALLOC1_CAPABILITY_LAYERED_BUFFERS = 2,
+ GRALLOC1_LAST_CAPABILITY = 2,
} gralloc1_capability_t;
typedef enum {
@@ -71,7 +74,7 @@
GRALLOC1_CONSUMER_USAGE_FOREIGN_BUFFERS = 1ULL << 21,
/* 1ULL << 22 */
- /* 1ULL << 23 */
+ GRALLOC1_CONSUMER_USAGE_GPU_DATA_BUFFER = 1ULL << 23,
/* 1ULL << 24 */
/* 1ULL << 25 */
/* 1ULL << 26 */
@@ -141,7 +144,9 @@
GRALLOC1_FUNCTION_LOCK = 18,
GRALLOC1_FUNCTION_LOCK_FLEX = 19,
GRALLOC1_FUNCTION_UNLOCK = 20,
- GRALLOC1_LAST_FUNCTION = 20,
+ GRALLOC1_FUNCTION_SET_LAYER_COUNT = 21,
+ GRALLOC1_FUNCTION_GET_LAYER_COUNT = 22,
+ GRALLOC1_LAST_FUNCTION = 22,
} gralloc1_function_descriptor_t;
typedef enum {
@@ -188,7 +193,7 @@
/* 1ULL << 20 */
/* 1ULL << 21 */
GRALLOC1_PRODUCER_USAGE_VIDEO_DECODER = 1ULL << 22,
- /* 1ULL << 23 */
+ GRALLOC1_PRODUCER_USAGE_SENSOR_DIRECT_DATA = 1ULL << 23,
/* 1ULL << 24 */
/* 1ULL << 25 */
/* 1ULL << 26 */
@@ -440,6 +445,30 @@
gralloc1_device_t* device, gralloc1_buffer_descriptor_t descriptor,
int32_t /*android_pixel_format_t*/ format);
+/* setLayerCount(..., layerCount)
+ * Function descriptor: GRALLOC1_FUNCTION_SET_LAYER_COUNT
+ * Must be provided by all gralloc1 devices that provide the
+ * GRALLOC1_CAPABILITY_LAYERED_BUFFERS capability.
+ *
+ * Sets the number of layers in the buffer.
+ *
+ * A buffer with multiple layers may be used as the backing store of an array
+ * texture. All layers of a buffer share the same characteristics (e.g.,
+ * dimensions, format, usage). Devices that do not support
+ * GRALLOC1_CAPABILITY_LAYERED_BUFFERS must allocate only buffers with a single
+ * layer.
+ *
+ * Parameters:
+ * layerCount - the desired number of layers, must be non-zero
+ *
+ * Returns GRALLOC1_ERROR_NONE or one of the following errors:
+ * GRALLOC1_ERROR_BAD_DESCRIPTOR - the buffer descriptor is invalid
+ * GRALLOC1_ERROR_BAD_VALUE - the layer count is invalid
+ */
+typedef int32_t /*gralloc1_error_t*/ (*GRALLOC1_PFN_SET_LAYER_COUNT)(
+ gralloc1_device_t* device, gralloc1_buffer_descriptor_t descriptor,
+ uint32_t layerCount);
+
/* setProducerUsage(..., usage)
* Function descriptor: GRALLOC1_FUNCTION_SET_PRODUCER_USAGE
* Must be provided by all gralloc1 devices
@@ -564,6 +593,28 @@
gralloc1_device_t* device, buffer_handle_t descriptor,
int32_t* outFormat);
+/* getLayerCount(..., outLayerCount)
+ * Function descriptor: GRALLOC1_FUNCTION_GET_LAYER_COUNT
+ * Must be provided by all gralloc1 devices that provide the
+ * GRALLOC1_CAPABILITY_LAYERED_BUFFERS capability.
+ *
+ * Gets the number of layers of the buffer.
+ *
+ * See setLayerCount for more information about this value.
+ *
+ * Parameters:
+ * outLayerCount - the number of layers in the image, must be non-NULL
+ *
+ * Returns GRALLOC1_ERROR_NONE or one of the following errors:
+ * GRALLOC1_ERROR_BAD_HANDLE - the buffer handle is invalid
+ * GRALLOC1_ERROR_UNSUPPORTED - the device is unable to retrieve the
+ * layer count from the buffer; see note [1] in this section's header for
+ * more information
+ */
+typedef int32_t /*gralloc1_error_t*/ (*GRALLOC1_PFN_GET_LAYER_COUNT)(
+ gralloc1_device_t* device, buffer_handle_t buffer,
+ uint32_t* outLayerCount);
+
/* getProducerUsage(..., outUsage)
* Function descriptor: GRALLOC1_FUNCTION_GET_PRODUCER_USAGE
* Must be provided by all gralloc1 devices
diff --git a/include/hardware/hwcomposer.h b/include/hardware/hwcomposer.h
index 7eca7c1..9eb1aaf 100644
--- a/include/hardware/hwcomposer.h
+++ b/include/hardware/hwcomposer.h
@@ -481,6 +481,7 @@
struct hw_module_t common;
} hwc_module_t;
+#define HWC_ERROR (-1)
typedef struct hwc_composer_device_1 {
/**
* Common methods of the hardware composer device. This *must* be the first member of
@@ -714,9 +715,9 @@
* (*getActiveConfig)() returns the index of the configuration that is
* currently active on the connected display. The index is relative to
* the list of configuration handles returned by getDisplayConfigs. If there
- * is no active configuration, -1 shall be returned.
+ * is no active configuration, HWC_ERROR shall be returned.
*
- * Returns the configuration index on success or -1 on error.
+ * Returns the configuration index on success or HWC_ERROR on error.
*
* This field is REQUIRED for HWC_DEVICE_API_VERSION_1_4 and later.
* It shall be NULL for previous versions.
diff --git a/include/hardware/hwcomposer_defs.h b/include/hardware/hwcomposer_defs.h
index 18b30bc..1e81e6e 100644
--- a/include/hardware/hwcomposer_defs.h
+++ b/include/hardware/hwcomposer_defs.h
@@ -136,9 +136,9 @@
*/
enum {
/*
- * HWC_SKIP_LAYER is set by SurfaceFlnger to indicate that the HAL
+ * HWC_SKIP_LAYER is set by SurfaceFlinger to indicate that the HAL
* shall not consider this layer for composition as it will be handled
- * by SurfaceFlinger (just as if compositionType was set to HWC_OVERLAY).
+ * by SurfaceFlinger (just as if compositionType was set to HWC_FRAMEBUFFER).
*/
HWC_SKIP_LAYER = 0x00000001,
diff --git a/include/hardware/keymaster_defs.h b/include/hardware/keymaster_defs.h
index 0f9bc27..f557ec1 100644
--- a/include/hardware/keymaster_defs.h
+++ b/include/hardware/keymaster_defs.h
@@ -135,6 +135,21 @@
KM_TAG_OS_PATCHLEVEL = KM_UINT | 706, /* Patch level of system (keymaster2) */
KM_TAG_UNIQUE_ID = KM_BYTES | 707, /* Used to provide unique ID in attestation */
KM_TAG_ATTESTATION_CHALLENGE = KM_BYTES | 708, /* Used to provide challenge in attestation */
+ KM_TAG_ATTESTATION_APPLICATION_ID = KM_BYTES | 709, /* Used to identify the set of possible
+ * applications of which one has initiated
+ * a key attestation */
+ KM_TAG_ATTESTATION_ID_BRAND = KM_BYTES | 710, /* Used to provide the device's brand name to be
+ included in attestation */
+ KM_TAG_ATTESTATION_ID_DEVICE = KM_BYTES | 711, /* Used to provide the device's device name to be
+ included in attestation */
+ KM_TAG_ATTESTATION_ID_PRODUCT = KM_BYTES | 712, /* Used to provide the device's product name to
+ be included in attestation */
+ KM_TAG_ATTESTATION_ID_SERIAL = KM_BYTES | 713, /* Used to provide the device's serial number to
+ be included in attestation */
+ KM_TAG_ATTESTATION_ID_IMEI = KM_BYTES | 714, /* Used to provide the device's IMEI to be
+ included in attestation */
+ KM_TAG_ATTESTATION_ID_MEID = KM_BYTES | 715, /* Used to provide the device's MEID to be
+ included in attestation */
/* Tags used only to provide data to or receive data from operations */
KM_TAG_ASSOCIATED_DATA = KM_BYTES | 1000, /* Used to provide associated data for AEAD modes. */
@@ -427,6 +442,8 @@
KM_ERROR_KEY_REQUIRES_UPGRADE = -62,
KM_ERROR_ATTESTATION_CHALLENGE_MISSING = -63,
KM_ERROR_KEYMASTER_NOT_CONFIGURED = -64,
+ KM_ERROR_ATTESTATION_APPLICATION_ID_MISSING = -65,
+ KM_ERROR_CANNOT_ATTEST_IDS = -66,
KM_ERROR_UNIMPLEMENTED = -100,
KM_ERROR_VERSION_MISMATCH = -101,
diff --git a/include/hardware/sensors-base.h b/include/hardware/sensors-base.h
new file mode 100644
index 0000000..b0f6223
--- /dev/null
+++ b/include/hardware/sensors-base.h
@@ -0,0 +1,137 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+// Source: android.hardware.sensors@1.0
+// Root: android.hardware:hardware/interfaces
+
+#ifndef HIDL_GENERATED_ANDROID_HARDWARE_SENSORS_V1_0_EXPORTED_CONSTANTS_H_
+#define HIDL_GENERATED_ANDROID_HARDWARE_SENSORS_V1_0_EXPORTED_CONSTANTS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+ SENSOR_HAL_NORMAL_MODE = 0,
+ SENSOR_HAL_DATA_INJECTION_MODE = 1,
+};
+
+enum {
+ SENSOR_TYPE_META_DATA = 0,
+ SENSOR_TYPE_ACCELEROMETER = 1,
+ SENSOR_TYPE_MAGNETIC_FIELD = 2,
+ SENSOR_TYPE_ORIENTATION = 3,
+ SENSOR_TYPE_GYROSCOPE = 4,
+ SENSOR_TYPE_LIGHT = 5,
+ SENSOR_TYPE_PRESSURE = 6,
+ SENSOR_TYPE_TEMPERATURE = 7,
+ SENSOR_TYPE_PROXIMITY = 8,
+ SENSOR_TYPE_GRAVITY = 9,
+ SENSOR_TYPE_LINEAR_ACCELERATION = 10,
+ SENSOR_TYPE_ROTATION_VECTOR = 11,
+ SENSOR_TYPE_RELATIVE_HUMIDITY = 12,
+ SENSOR_TYPE_AMBIENT_TEMPERATURE = 13,
+ SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = 14,
+ SENSOR_TYPE_GAME_ROTATION_VECTOR = 15,
+ SENSOR_TYPE_GYROSCOPE_UNCALIBRATED = 16,
+ SENSOR_TYPE_SIGNIFICANT_MOTION = 17,
+ SENSOR_TYPE_STEP_DETECTOR = 18,
+ SENSOR_TYPE_STEP_COUNTER = 19,
+ SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = 20,
+ SENSOR_TYPE_HEART_RATE = 21,
+ SENSOR_TYPE_TILT_DETECTOR = 22,
+ SENSOR_TYPE_WAKE_GESTURE = 23,
+ SENSOR_TYPE_GLANCE_GESTURE = 24,
+ SENSOR_TYPE_PICK_UP_GESTURE = 25,
+ SENSOR_TYPE_WRIST_TILT_GESTURE = 26,
+ SENSOR_TYPE_DEVICE_ORIENTATION = 27,
+ SENSOR_TYPE_POSE_6DOF = 28,
+ SENSOR_TYPE_STATIONARY_DETECT = 29,
+ SENSOR_TYPE_MOTION_DETECT = 30,
+ SENSOR_TYPE_HEART_BEAT = 31,
+ SENSOR_TYPE_DYNAMIC_SENSOR_META = 32,
+ SENSOR_TYPE_ADDITIONAL_INFO = 33,
+ SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT = 34,
+ SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 35,
+ 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
+};
+
+typedef enum {
+ SENSOR_FLAG_SHIFT_REPORTING_MODE = 1,
+ SENSOR_FLAG_SHIFT_DATA_INJECTION = 4,
+ SENSOR_FLAG_SHIFT_DYNAMIC_SENSOR = 5,
+ SENSOR_FLAG_SHIFT_ADDITIONAL_INFO = 6,
+ SENSOR_FLAG_SHIFT_DIRECT_REPORT = 7,
+ SENSOR_FLAG_SHIFT_DIRECT_CHANNEL = 10,
+} sensor_flag_shift_t;
+
+enum {
+ SENSOR_STATUS_NO_CONTACT = -1, // (-1)
+ SENSOR_STATUS_UNRELIABLE = 0,
+ SENSOR_STATUS_ACCURACY_LOW = 1,
+ SENSOR_STATUS_ACCURACY_MEDIUM = 2,
+ SENSOR_STATUS_ACCURACY_HIGH = 3,
+};
+
+enum {
+ META_DATA_FLUSH_COMPLETE = 1u, // 1
+};
+
+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
+} 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,
+} direct_rate_level_t;
+
+typedef enum {
+ SENSOR_DIRECT_MEM_TYPE_ASHMEM = 1,
+ SENSOR_DIRECT_MEM_TYPE_GRALLOC = 2,
+} direct_mem_type_t;
+
+typedef enum {
+ SENSOR_DIRECT_FMT_SENSORS_EVENT = 1,
+} direct_format_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // HIDL_GENERATED_ANDROID_HARDWARE_SENSORS_V1_0_EXPORTED_CONSTANTS_H_
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h
index 322abe6..8c5fa16 100644
--- a/include/hardware/sensors.h
+++ b/include/hardware/sensors.h
@@ -24,6 +24,8 @@
#include <hardware/hardware.h>
#include <cutils/native_handle.h>
+#include "sensors-base.h"
+
__BEGIN_DECLS
/*****************************************************************************/
@@ -54,14 +56,15 @@
#define SENSORS_HARDWARE_POLL "poll"
/**
- * Handles must be higher than SENSORS_HANDLE_BASE and must be unique.
- * A Handle identifies a given sensors. The handle is used to activate
- * and/or deactivate sensors.
- * In this version of the API there can only be 256 handles.
+ * Sensor handle is greater than 0 and less than INT32_MAX.
+ *
+ * **** Deprecated ****
+ * Defined values below are kept for code compatibility. Note sensor handle can be as large as
+ * INT32_MAX.
*/
#define SENSORS_HANDLE_BASE 0
-#define SENSORS_HANDLE_BITS 8
-#define SENSORS_HANDLE_COUNT (1<<SENSORS_HANDLE_BITS)
+#define SENSORS_HANDLE_BITS 31
+#define SENSORS_HANDLE_COUNT (1ull<<SENSORS_HANDLE_BITS)
/*
@@ -82,7 +85,7 @@
*/
enum {
/* a previous flush operation has completed */
- META_DATA_FLUSH_COMPLETE = 1,
+ // META_DATA_FLUSH_COMPLETE = 1,
META_DATA_VERSION /* always last, leave auto-assigned */
};
@@ -94,27 +97,11 @@
#define SENSOR_PERMISSION_BODY_SENSORS "android.permission.BODY_SENSORS"
/*
- * Availability: SENSORS_DEVICE_API_VERSION_1_4
- * Sensor HAL modes used in set_operation_mode method
+ * sensor flags legacy names
+ *
+ * please use SENSOR_FLAG_* directly for new implementation.
+ * @see sensor_t
*/
-enum {
- /*
- * Operating modes for the HAL.
- */
-
- /*
- * Normal mode operation. This is the default state of operation.
- * The HAL shall initialize into this mode on device startup.
- */
- SENSOR_HAL_NORMAL_MODE = 0,
-
- /*
- * Data Injection mode. In this mode, the device shall not source data from the
- * physical sensors as it would in normal mode. Instead sensor data is
- * injected by the sensor service.
- */
- SENSOR_HAL_DATA_INJECTION_MODE = 0x1
-};
#define SENSOR_FLAG_MASK(nbit, shift) (((1<<(nbit))-1)<<(shift))
#define SENSOR_FLAG_MASK_1(shift) SENSOR_FLAG_MASK(1, shift)
@@ -122,749 +109,82 @@
/*
* Mask and shift for reporting mode sensor flags defined above.
*/
-#define REPORTING_MODE_SHIFT (1)
+#define REPORTING_MODE_SHIFT SENSOR_FLAG_SHIFT_REPORTING_MODE
#define REPORTING_MODE_NBIT (3)
-#define REPORTING_MODE_MASK SENSOR_FLAG_MASK(REPORTING_MODE_NBIT, REPORTING_MODE_SHIFT)
- // 0xE
+#define REPORTING_MODE_MASK SENSOR_FLAG_MASK_REPORTING_MODE
/*
* Mask and shift for data_injection mode sensor flags defined above.
*/
-#define DATA_INJECTION_SHIFT (4)
-#define DATA_INJECTION_MASK SENSOR_FLAG_MASK_1(DATA_INJECTION_SHIFT) //0x10
+#define DATA_INJECTION_SHIFT SENSOR_FLAG_SHIFT_DATA_INJECTION
+#define DATA_INJECTION_MASK SENSOR_FLAG_DATA_INJECTION
/*
* Mask and shift for dynamic sensor flag.
*/
-#define DYNAMIC_SENSOR_SHIFT (5)
-#define DYNAMIC_SENSOR_MASK SENSOR_FLAG_MASK_1(DYNAMIC_SENSOR_SHIFT) //0x20
+#define DYNAMIC_SENSOR_SHIFT SENSOR_FLAG_SHIFT_DYNAMIC_SENSOR
+#define DYNAMIC_SENSOR_MASK SENSOR_FLAG_DYNAMIC_SENSOR
/*
* Mask and shift for sensor additional information support.
*/
-#define ADDITIONAL_INFO_SHIFT (6)
-#define ADDITIONAL_INFO_MASK SENSOR_FLAG_MASK_1(ADDITIONAL_INFO_SHIFT) //0x40
+#define ADDITIONAL_INFO_SHIFT SENSOR_FLAG_SHIFT_ADDITIONAL_INFO
+#define ADDITIONAL_INFO_MASK SENSOR_FLAG_ADDITIONAL_INFO
/*
- * Availability: SENSORS_DEVICE_API_VERSION_1_3
- * Sensor flags used in sensor_t.flags.
+ * Legacy alias of SENSOR_TYPE_MAGNETIC_FIELD.
+ *
+ * Previously, the type of a sensor measuring local magnetic field is named
+ * SENSOR_TYPE_GEOMAGNETIC_FIELD and SENSOR_TYPE_MAGNETIC_FIELD is its alias.
+ * SENSOR_TYPE_MAGNETIC_FIELD is redefined as primary name to avoid confusion.
+ * SENSOR_TYPE_GEOMAGNETIC_FIELD is the alias and is deprecating. New implementation must not use
+ * SENSOR_TYPE_GEOMAGNETIC_FIELD.
*/
-enum {
- /*
- * Whether this sensor wakes up the AP from suspend mode when data is available. Whenever
- * sensor events are delivered from a wake_up sensor, the driver needs to hold a wake_lock till
- * the events are read by the SensorService i.e till sensors_poll_device_t.poll() is called the
- * next time. Once poll is called again it means events have been read by the SensorService, the
- * driver can safely release the wake_lock. SensorService will continue to hold a wake_lock till
- * the app actually reads the events.
- */
- SENSOR_FLAG_WAKE_UP = 1U << 0,
- /*
- * Reporting modes for various sensors. Each sensor will have exactly one of these modes set.
- * The least significant 2nd, 3rd and 4th bits are used to represent four possible reporting
- * modes.
- */
- SENSOR_FLAG_CONTINUOUS_MODE = 0, // 0000
- SENSOR_FLAG_ON_CHANGE_MODE = 0x2, // 0010
- SENSOR_FLAG_ONE_SHOT_MODE = 0x4, // 0100
- SENSOR_FLAG_SPECIAL_REPORTING_MODE = 0x6, // 0110
-
- /*
- * Set this flag if the sensor supports data_injection mode and allows data to be injected
- * from the SensorService. When in data_injection ONLY sensors with this flag set are injected
- * sensor data and only sensors with this flag set are activated. Eg: Accelerometer and Step
- * Counter sensors can be set with this flag and SensorService will inject accelerometer data
- * and read the corresponding step counts.
- */
- SENSOR_FLAG_SUPPORTS_DATA_INJECTION = DATA_INJECTION_MASK, // 1 0000
-
- /*
- * Set this flag if the sensor is a dynamically connected sensor. See
- * dynamic_sensor_meta_event_t and SENSOR_TYPE_DYNAMIC_SENSOR_META for details.
- */
- SENSOR_FLAG_DYNAMIC_SENSOR = DYNAMIC_SENSOR_MASK,
-
- /*
- * Set this flag if sensor additional information is supported. See SENSOR_TYPE_ADDITIONAL_INFO
- * and additional_info_event_t for details.
- */
- SENSOR_FLAG_ADDITIONAL_INFO = ADDITIONAL_INFO_MASK
-};
-
+#define SENSOR_TYPE_GEOMAGNETIC_FIELD SENSOR_TYPE_MAGNETIC_FIELD
/*
- * Sensor type
+ * Sensor string types for Android defined sensor types.
*
- * Each sensor has a type which defines what this sensor measures and how
- * measures are reported. See the Base sensors and Composite sensors lists
- * for complete descriptions:
- * http://source.android.com/devices/sensors/base_triggers.html
- * http://source.android.com/devices/sensors/composite_sensors.html
+ * For Android defined sensor types, string type will be override in sensor service and thus no
+ * longer needed to be added to sensor_t data structure.
*
- * Device manufacturers (OEMs) can define their own sensor types, for
- * their private use by applications or services provided by them. Such
- * sensor types are specific to an OEM and can't be exposed in the SDK.
- * These types must start at SENSOR_TYPE_DEVICE_PRIVATE_BASE.
- *
- * All sensors defined outside of the device private range must correspond to
- * a type defined in this file, and must satisfy the characteristics listed in
- * the description of the sensor type.
- *
- * Starting with version SENSORS_DEVICE_API_VERSION_1_2, each sensor also
- * has a stringType.
- * - StringType of sensors inside of the device private range MUST be prefixed
- * by the sensor provider's or OEM reverse domain name. In particular, they
- * cannot use the "android.sensor" prefix.
- * - StringType of sensors outside of the device private range MUST correspond
- * to the one defined in this file (starting with "android.sensor").
- * For example, accelerometers must have
- * type=SENSOR_TYPE_ACCELEROMETER and
- * stringType=SENSOR_STRING_TYPE_ACCELEROMETER
- *
- * When android introduces a new sensor type that can replace an OEM-defined
- * sensor type, the OEM must use the official sensor type and stringType on
- * versions of the HAL that support this new official sensor type.
- *
- * Example (made up): Suppose Google's Glass team wants to surface a sensor
- * detecting that Glass is on a head.
- * - Such a sensor is not officially supported in android KitKat
- * - Glass devices launching on KitKat can implement a sensor with
- * type = 0x10001 and stringType = "com.google.glass.onheaddetector"
- * - In L android release, if android decides to define
- * SENSOR_TYPE_ON_HEAD_DETECTOR and STRING_SENSOR_TYPE_ON_HEAD_DETECTOR,
- * those types should replace the Glass-team-specific types in all future
- * launches.
- * - When launching Glass on the L release, Google should now use the official
- * type (SENSOR_TYPE_ON_HEAD_DETECTOR) and stringType.
- * - This way, all applications can now use this sensor.
+ * These definitions are going to be removed soon.
*/
-
-/*
- * Base for device manufacturers private sensor types.
- * These sensor types can't be exposed in the SDK.
- */
-#define SENSOR_TYPE_DEVICE_PRIVATE_BASE 0x10000
-
-/*
- * SENSOR_TYPE_META_DATA
- * reporting-mode: n/a
- * wake-up sensor: n/a
- *
- * NO SENSOR OF THAT TYPE MUST BE RETURNED (*get_sensors_list)()
- *
- * SENSOR_TYPE_META_DATA is a special token used to populate the
- * sensors_meta_data_event structure. It doesn't correspond to a physical
- * sensor. sensors_meta_data_event are special, they exist only inside
- * the HAL and are generated spontaneously, as opposed to be related to
- * a physical sensor.
- *
- * sensors_meta_data_event_t.version must be META_DATA_VERSION
- * sensors_meta_data_event_t.sensor must be 0
- * sensors_meta_data_event_t.type must be SENSOR_TYPE_META_DATA
- * sensors_meta_data_event_t.reserved must be 0
- * sensors_meta_data_event_t.timestamp must be 0
- *
- * The payload is a meta_data_event_t, where:
- * meta_data_event_t.what can take the following values:
- *
- * META_DATA_FLUSH_COMPLETE
- * This event indicates that a previous (*flush)() call has completed for the sensor
- * handle specified in meta_data_event_t.sensor.
- * see (*flush)() for more details
- *
- * All other values for meta_data_event_t.what are reserved and
- * must not be used.
- *
- */
-#define SENSOR_TYPE_META_DATA (0)
-
-/*
- * Wake up sensors.
- * Each sensor may have either or both a wake-up and a non-wake variant.
- * When registered in batch mode, wake-up sensors will wake up the AP when
- * their FIFOs are full or when the batch timeout expires. 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 or when
- * the batch timeout expires without losing events. Wake-up and non wake-up variants
- * of each sensor can be activated at different rates independently of each other.
- *
- * Note: Proximity sensor and significant motion sensor which were defined in previous
- * releases are also wake-up sensors and should be treated as such. Wake-up one-shot
- * sensors like SIGNIFICANT_MOTION cannot be batched, hence the text about batch above
- * doesn't apply to them. See the definitions of SENSOR_TYPE_PROXIMITY and
- * SENSOR_TYPE_SIGNIFICANT_MOTION for more info.
- *
- * Set SENSOR_FLAG_WAKE_UP flag for all wake-up sensors.
- *
- * For example, A device can have two sensors both of SENSOR_TYPE_ACCELEROMETER and
- * one of them can be a wake_up sensor (with SENSOR_FLAG_WAKE_UP flag set) and the other
- * can be a regular non wake_up sensor. Both of these sensors must be activated/deactivated
- * independently of the other.
- */
-
-/*
- * SENSOR_TYPE_ACCELEROMETER
- * reporting-mode: continuous
- *
- * All values are in SI units (m/s^2) and measure the acceleration of the
- * device minus the force of gravity.
- *
- * Implement the non-wake-up version of this sensor and implement the wake-up
- * version if the system possesses a wake up fifo.
- */
-#define SENSOR_TYPE_ACCELEROMETER (1)
-#define SENSOR_STRING_TYPE_ACCELEROMETER "android.sensor.accelerometer"
-
-/*
- * SENSOR_TYPE_GEOMAGNETIC_FIELD
- * reporting-mode: continuous
- *
- * All values are in micro-Tesla (uT) and measure the geomagnetic
- * field in the X, Y and Z axis.
- *
- * Implement the non-wake-up version of this sensor and implement the wake-up
- * version if the system possesses a wake up fifo.
- */
-#define SENSOR_TYPE_GEOMAGNETIC_FIELD (2)
-#define SENSOR_TYPE_MAGNETIC_FIELD SENSOR_TYPE_GEOMAGNETIC_FIELD
-#define SENSOR_STRING_TYPE_MAGNETIC_FIELD "android.sensor.magnetic_field"
-
-/*
- * SENSOR_TYPE_ORIENTATION
- * reporting-mode: continuous
- *
- * All values are angles in degrees.
- *
- * Orientation sensors return sensor events for all 3 axes at a constant
- * rate defined by setDelay().
- *
- * Implement the non-wake-up version of this sensor and implement the wake-up
- * version if the system possesses a wake up fifo.
- */
-#define SENSOR_TYPE_ORIENTATION (3)
-#define SENSOR_STRING_TYPE_ORIENTATION "android.sensor.orientation"
-
-/*
- * SENSOR_TYPE_GYROSCOPE
- * reporting-mode: continuous
- *
- * All values are in radians/second and measure the rate of rotation
- * around the X, Y and Z axis.
- *
- * Implement the non-wake-up version of this sensor and implement the wake-up
- * version if the system possesses a wake up fifo.
- */
-#define SENSOR_TYPE_GYROSCOPE (4)
-#define SENSOR_STRING_TYPE_GYROSCOPE "android.sensor.gyroscope"
-
-/*
- * SENSOR_TYPE_LIGHT
- * reporting-mode: on-change
- *
- * The light sensor value is returned in SI lux units.
- *
- * Both wake-up and non wake-up versions are useful.
- */
-#define SENSOR_TYPE_LIGHT (5)
-#define SENSOR_STRING_TYPE_LIGHT "android.sensor.light"
-
-/*
- * SENSOR_TYPE_PRESSURE
- * reporting-mode: continuous
- *
- * The pressure sensor return the athmospheric pressure in hectopascal (hPa)
- *
- * Implement the non-wake-up version of this sensor and implement the wake-up
- * version if the system possesses a wake up fifo.
- */
-#define SENSOR_TYPE_PRESSURE (6)
-#define SENSOR_STRING_TYPE_PRESSURE "android.sensor.pressure"
-
-/* SENSOR_TYPE_TEMPERATURE is deprecated in the HAL */
-#define SENSOR_TYPE_TEMPERATURE (7)
-#define SENSOR_STRING_TYPE_TEMPERATURE "android.sensor.temperature"
-
-/*
- * SENSOR_TYPE_PROXIMITY
- * reporting-mode: on-change
- *
- * The proximity sensor which turns the screen off and back on during calls is the
- * wake-up proximity sensor. Implement wake-up proximity sensor before implementing
- * a non wake-up proximity sensor. For the wake-up proximity sensor set the flag
- * SENSOR_FLAG_WAKE_UP.
- * The value corresponds to the distance to the nearest object in centimeters.
- */
-#define SENSOR_TYPE_PROXIMITY (8)
-#define SENSOR_STRING_TYPE_PROXIMITY "android.sensor.proximity"
-
-/*
- * SENSOR_TYPE_GRAVITY
- * reporting-mode: continuous
- *
- * A gravity output indicates the direction of and magnitude of gravity in
- * the devices's coordinates.
- *
- * Implement the non-wake-up version of this sensor and implement the wake-up
- * version if the system possesses a wake up fifo.
- */
-#define SENSOR_TYPE_GRAVITY (9)
-#define SENSOR_STRING_TYPE_GRAVITY "android.sensor.gravity"
-
-/*
- * SENSOR_TYPE_LINEAR_ACCELERATION
- * reporting-mode: continuous
- *
- * Indicates the linear acceleration of the device in device coordinates,
- * not including gravity.
- *
- * Implement the non-wake-up version of this sensor and implement the wake-up
- * version if the system possesses a wake up fifo.
- */
-#define SENSOR_TYPE_LINEAR_ACCELERATION (10)
-#define SENSOR_STRING_TYPE_LINEAR_ACCELERATION "android.sensor.linear_acceleration"
-
-
-/*
- * SENSOR_TYPE_ROTATION_VECTOR
- * reporting-mode: continuous
- *
- * The rotation vector symbolizes the orientation of the device relative to the
- * East-North-Up coordinates frame.
- *
- * Implement the non-wake-up version of this sensor and implement the wake-up
- * version if the system possesses a wake up fifo.
- */
-#define SENSOR_TYPE_ROTATION_VECTOR (11)
-#define SENSOR_STRING_TYPE_ROTATION_VECTOR "android.sensor.rotation_vector"
-
-/*
- * SENSOR_TYPE_RELATIVE_HUMIDITY
- * reporting-mode: on-change
- *
- * A relative humidity sensor measures relative ambient air humidity and
- * returns a value in percent.
- *
- * Both wake-up and non wake-up versions are useful.
- */
-#define SENSOR_TYPE_RELATIVE_HUMIDITY (12)
-#define SENSOR_STRING_TYPE_RELATIVE_HUMIDITY "android.sensor.relative_humidity"
-
-/*
- * SENSOR_TYPE_AMBIENT_TEMPERATURE
- * reporting-mode: on-change
- *
- * The ambient (room) temperature in degree Celsius.
- *
- * Both wake-up and non wake-up versions are useful.
- */
-#define SENSOR_TYPE_AMBIENT_TEMPERATURE (13)
-#define SENSOR_STRING_TYPE_AMBIENT_TEMPERATURE "android.sensor.ambient_temperature"
-
-/*
- * SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED
- * reporting-mode: continuous
- *
- * Similar to SENSOR_TYPE_MAGNETIC_FIELD, but the hard iron calibration is
- * reported separately instead of being included in the measurement.
- *
- * Implement the non-wake-up version of this sensor and implement the wake-up
- * version if the system possesses a wake up fifo.
- */
-#define SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED (14)
-#define SENSOR_STRING_TYPE_MAGNETIC_FIELD_UNCALIBRATED "android.sensor.magnetic_field_uncalibrated"
-
-/*
- * SENSOR_TYPE_GAME_ROTATION_VECTOR
- * reporting-mode: continuous
- *
- * Similar to SENSOR_TYPE_ROTATION_VECTOR, but not using the geomagnetic
- * field.
- *
- * Implement the non-wake-up version of this sensor and implement the wake-up
- * version if the system possesses a wake up fifo.
- */
-#define SENSOR_TYPE_GAME_ROTATION_VECTOR (15)
-#define SENSOR_STRING_TYPE_GAME_ROTATION_VECTOR "android.sensor.game_rotation_vector"
-
-/*
- * SENSOR_TYPE_GYROSCOPE_UNCALIBRATED
- * reporting-mode: continuous
- *
- * All values are in radians/second and measure the rate of rotation
- * around the X, Y and Z axis.
- *
- * Implement the non-wake-up version of this sensor and implement the wake-up
- * version if the system possesses a wake up fifo.
- */
-#define SENSOR_TYPE_GYROSCOPE_UNCALIBRATED (16)
-#define SENSOR_STRING_TYPE_GYROSCOPE_UNCALIBRATED "android.sensor.gyroscope_uncalibrated"
-
-/*
- * SENSOR_TYPE_SIGNIFICANT_MOTION
- * reporting-mode: one-shot
- *
- * A sensor of this type triggers an event each time significant motion
- * is detected and automatically disables itself.
- * For Significant Motion sensor to be useful, it must be defined as a
- * wake-up sensor. (set SENSOR_FLAG_WAKE_UP). Implement the wake-up significant motion
- * sensor. A non wake-up version is not useful.
- * The only allowed value to return is 1.0.
- */
-
-#define SENSOR_TYPE_SIGNIFICANT_MOTION (17)
-#define SENSOR_STRING_TYPE_SIGNIFICANT_MOTION "android.sensor.significant_motion"
-
-/*
- * SENSOR_TYPE_STEP_DETECTOR
- * reporting-mode: special
- *
- * A sensor of this type triggers an event each time a step is taken
- * by the user. The only allowed value to return is 1.0 and an event
- * is generated for each step.
- *
- * Both wake-up and non wake-up versions are useful.
- */
-
-#define SENSOR_TYPE_STEP_DETECTOR (18)
-#define SENSOR_STRING_TYPE_STEP_DETECTOR "android.sensor.step_detector"
-
-
-/*
- * SENSOR_TYPE_STEP_COUNTER
- * reporting-mode: on-change
- *
- * A sensor of this type returns the number of steps taken by the user since
- * the last reboot while activated. The value is returned as a uint64_t and is
- * reset to zero only on a system / android reboot.
- *
- * Implement the non-wake-up version of this sensor and implement the wake-up
- * version if the system possesses a wake up fifo.
- */
-
-#define SENSOR_TYPE_STEP_COUNTER (19)
-#define SENSOR_STRING_TYPE_STEP_COUNTER "android.sensor.step_counter"
-
-/*
- * SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR
- * reporting-mode: continuous
- *
- * Similar to SENSOR_TYPE_ROTATION_VECTOR, but using a magnetometer instead
- * of using a gyroscope.
- *
- * Implement the non-wake-up version of this sensor and implement the wake-up
- * version if the system possesses a wake up fifo.
- */
-#define SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR (20)
-#define SENSOR_STRING_TYPE_GEOMAGNETIC_ROTATION_VECTOR "android.sensor.geomagnetic_rotation_vector"
-
-/*
- * SENSOR_TYPE_HEART_RATE
- * reporting-mode: on-change
- *
- * A sensor of this type returns the current heart rate.
- * The events contain the current heart rate in beats per minute (BPM) and the
- * status of the sensor during the measurement. See heart_rate_event_t for more
- * details.
- *
- * Because this sensor is on-change, events must be generated when and only
- * when heart_rate.bpm or heart_rate.status have changed since the last
- * event. In particular, upon the first activation, unless the device is known
- * to not be on the body, the status field of the first event must be set to
- * SENSOR_STATUS_UNRELIABLE. The event should be generated no faster than every
- * period_ns passed to setDelay() or to batch().
- * See the definition of the on-change reporting mode for more information.
- *
- * sensor_t.requiredPermission must be set to SENSOR_PERMISSION_BODY_SENSORS.
- *
- * Both wake-up and non wake-up versions are useful.
- */
-#define SENSOR_TYPE_HEART_RATE (21)
-#define SENSOR_STRING_TYPE_HEART_RATE "android.sensor.heart_rate"
-
-/*
- * SENSOR_TYPE_WAKE_UP_TILT_DETECTOR
- * reporting-mode: special (setDelay has no impact)
- *
- * A sensor of this type generates an event each time a tilt event is detected. A tilt event
- * should be generated if the direction of the 2-seconds window average gravity changed by at least
- * 35 degrees since the activation or the last trigger of the sensor.
- * reference_estimated_gravity = average of accelerometer measurements over the first
- * 1 second after activation or the estimated gravity at the last
- * trigger.
- * current_estimated_gravity = average of accelerometer measurements over the last 2 seconds.
- * trigger when angle (reference_estimated_gravity, current_estimated_gravity) > 35 degrees
- *
- * Large accelerations without a change in phone orientation should not trigger a tilt event.
- * For example, a sharp turn or strong acceleration while driving a car should not trigger a tilt
- * event, even though the angle of the average acceleration might vary by more than 35 degrees.
- *
- * Typically, this sensor is implemented with the help of only an accelerometer. Other sensors can
- * be used as well if they do not increase the power consumption significantly. This is a low power
- * sensor that should allow the AP to go into suspend mode. Do not emulate this sensor in the HAL.
- * Like other wake up sensors, the driver is expected to a hold a wake_lock with a timeout of 200 ms
- * while reporting this event. The only allowed return value is 1.0.
- *
- * Implement only the wake-up version of this sensor.
- */
-#define SENSOR_TYPE_TILT_DETECTOR (22)
-#define SENSOR_STRING_TYPE_TILT_DETECTOR "android.sensor.tilt_detector"
-
-/*
- * SENSOR_TYPE_WAKE_GESTURE
- * reporting-mode: one-shot
- *
- * A sensor enabling waking up the device based on a device specific motion.
- *
- * When this sensor triggers, the device behaves as if the power button was
- * pressed, turning the screen on. This behavior (turning on the screen when
- * this sensor triggers) might be deactivated by the user in the device
- * settings. Changes in settings do not impact the behavior of the sensor:
- * only whether the framework turns the screen on when it triggers.
- *
- * The actual gesture to be detected is not specified, and can be chosen by
- * the manufacturer of the device.
- * This sensor must be low power, as it is likely to be activated 24/7.
- * The only allowed value to return is 1.0.
- *
- * Implement only the wake-up version of this sensor.
- */
-#define SENSOR_TYPE_WAKE_GESTURE (23)
-#define SENSOR_STRING_TYPE_WAKE_GESTURE "android.sensor.wake_gesture"
-
-/*
- * SENSOR_TYPE_GLANCE_GESTURE
- * reporting-mode: one-shot
- *
- * A sensor enabling briefly turning the screen on to enable the user to
- * glance content on screen based on a specific motion. The device should
- * turn the screen off after a few moments.
- *
- * When this sensor triggers, the device turns the screen on momentarily
- * to allow the user to glance notifications or other content while the
- * device remains locked in a non-interactive state (dozing). This behavior
- * (briefly turning on the screen when this sensor triggers) might be deactivated
- * by the user in the device settings. Changes in settings do not impact the
- * behavior of the sensor: only whether the framework briefly turns the screen on
- * when it triggers.
- *
- * The actual gesture to be detected is not specified, and can be chosen by
- * the manufacturer of the device.
- * This sensor must be low power, as it is likely to be activated 24/7.
- * The only allowed value to return is 1.0.
- *
- * Implement only the wake-up version of this sensor.
- */
-#define SENSOR_TYPE_GLANCE_GESTURE (24)
-#define SENSOR_STRING_TYPE_GLANCE_GESTURE "android.sensor.glance_gesture"
-
-/**
- * SENSOR_TYPE_PICK_UP_GESTURE
- * reporting-mode: one-shot
- *
- * A sensor of this type triggers when the device is picked up regardless of wherever is was
- * before (desk, pocket, bag). The only allowed return value is 1.0.
- * This sensor de-activates itself immediately after it triggers.
- *
- * Implement only the wake-up version of this sensor.
- */
-#define SENSOR_TYPE_PICK_UP_GESTURE (25)
-#define SENSOR_STRING_TYPE_PICK_UP_GESTURE "android.sensor.pick_up_gesture"
-
-/*
- * SENSOR_TYPE_WRIST_TILT_GESTURE
- * trigger-mode: special
- * wake-up sensor: yes
- *
- * A sensor of this type triggers an event each time a tilt of the wrist-worn
- * device is detected.
- *
- * This sensor must be low power, as it is likely to be activated 24/7.
- * The only allowed value to return is 1.0.
- *
- * Implement only the wake-up version of this sensor.
- */
-#define SENSOR_TYPE_WRIST_TILT_GESTURE (26)
-#define SENSOR_STRING_TYPE_WRIST_TILT_GESTURE "android.sensor.wrist_tilt_gesture"
-
-/*
- * SENSOR_TYPE_DEVICE_ORIENTATION
- * reporting-mode: on-change
- *
- * The current orientation of the device. The value should be reported in the
- * first element of the 'data' member variable in sensors_event_t. The only
- * values that can be reported are (please refer to Android Sensor Coordinate
- * System to understand the X and Y axis direction with respect to default
- * orientation):
- * - 0: device is in default orientation (Y axis is vertical and points up)
- * - 1: device is rotated 90 degrees counter-clockwise from default
- * orientation (X axis is vertical and points up)
- * - 2: device is rotated 180 degrees from default orientation (Y axis is
- * vertical and points down)
- * - 3: device is rotated 90 degrees clockwise from default orientation (X axis
- * is vertical and points down)
- *
- * Moving the device to an orientation where the Z axis is vertical (either up
- * or down) should not cause a new event to be reported.
- *
- * To improve the user experience of this sensor, it is recommended to implement
- * some physical (i.e., rotation angle) and temporal (i.e., delay) hysteresis.
- * In other words, minor or transient rotations should not cause a new event to
- * be reported.
- *
- * This sensor should only be implemented with the help of an accelerometer.
- * This is a low power sensor that should reduce the number of interrupts of the
- * AP. Do not emulate this sensor in the HAL.
- *
- * Both wake-up and non wake-up versions are useful.
- */
-#define SENSOR_TYPE_DEVICE_ORIENTATION (27)
-#define SENSOR_STRING_TYPE_DEVICE_ORIENTATION "android.sensor.device_orientation"
-
-/*
- * SENSOR_TYPE_POSE_6DOF
- * trigger-mode: continuous
- *
- * A sensor of this type returns the pose of the device.
- * Pose of the device is defined as the orientation of the device from a
- * Earth Centered Earth Fixed frame and the translation from an arbitrary
- * point at subscription.
- *
- * This sensor can be high power. It can use any and all of the following
- * . Accelerometer
- * . Gyroscope
- * . Camera
- * . Depth Camera
- *
- */
-#define SENSOR_TYPE_POSE_6DOF (28)
-#define SENSOR_STRING_TYPE_POSE_6DOF "android.sensor.pose_6dof"
-
-/*
- * SENSOR_TYPE_STATIONARY_DETECT
- * trigger mode: one shot
- *
- * A sensor of this type returns an event if the device is still/stationary for
- * a while. The period of time to monitor for statinarity should be greater than
- * 5 seconds, and less than 10 seconds.
- *
- * Stationarity here refers to absolute stationarity. eg: device on desk.
- *
- * The only allowed value to return is 1.0.
- */
-#define SENSOR_TYPE_STATIONARY_DETECT (29)
+#define SENSOR_STRING_TYPE_ACCELEROMETER "android.sensor.accelerometer"
+#define SENSOR_STRING_TYPE_MAGNETIC_FIELD "android.sensor.magnetic_field"
+#define SENSOR_STRING_TYPE_ORIENTATION "android.sensor.orientation"
+#define SENSOR_STRING_TYPE_GYROSCOPE "android.sensor.gyroscope"
+#define SENSOR_STRING_TYPE_LIGHT "android.sensor.light"
+#define SENSOR_STRING_TYPE_PRESSURE "android.sensor.pressure"
+#define SENSOR_STRING_TYPE_TEMPERATURE "android.sensor.temperature"
+#define SENSOR_STRING_TYPE_PROXIMITY "android.sensor.proximity"
+#define SENSOR_STRING_TYPE_GRAVITY "android.sensor.gravity"
+#define SENSOR_STRING_TYPE_LINEAR_ACCELERATION "android.sensor.linear_acceleration"
+#define SENSOR_STRING_TYPE_ROTATION_VECTOR "android.sensor.rotation_vector"
+#define SENSOR_STRING_TYPE_RELATIVE_HUMIDITY "android.sensor.relative_humidity"
+#define SENSOR_STRING_TYPE_AMBIENT_TEMPERATURE "android.sensor.ambient_temperature"
+#define SENSOR_STRING_TYPE_MAGNETIC_FIELD_UNCALIBRATED "android.sensor.magnetic_field_uncalibrated"
+#define SENSOR_STRING_TYPE_GAME_ROTATION_VECTOR "android.sensor.game_rotation_vector"
+#define SENSOR_STRING_TYPE_GYROSCOPE_UNCALIBRATED "android.sensor.gyroscope_uncalibrated"
+#define SENSOR_STRING_TYPE_SIGNIFICANT_MOTION "android.sensor.significant_motion"
+#define SENSOR_STRING_TYPE_STEP_DETECTOR "android.sensor.step_detector"
+#define SENSOR_STRING_TYPE_STEP_COUNTER "android.sensor.step_counter"
+#define SENSOR_STRING_TYPE_GEOMAGNETIC_ROTATION_VECTOR "android.sensor.geomagnetic_rotation_vector"
+#define SENSOR_STRING_TYPE_HEART_RATE "android.sensor.heart_rate"
+#define SENSOR_STRING_TYPE_TILT_DETECTOR "android.sensor.tilt_detector"
+#define SENSOR_STRING_TYPE_WAKE_GESTURE "android.sensor.wake_gesture"
+#define SENSOR_STRING_TYPE_GLANCE_GESTURE "android.sensor.glance_gesture"
+#define SENSOR_STRING_TYPE_PICK_UP_GESTURE "android.sensor.pick_up_gesture"
+#define SENSOR_STRING_TYPE_WRIST_TILT_GESTURE "android.sensor.wrist_tilt_gesture"
+#define SENSOR_STRING_TYPE_DEVICE_ORIENTATION "android.sensor.device_orientation"
+#define SENSOR_STRING_TYPE_POSE_6DOF "android.sensor.pose_6dof"
#define SENSOR_STRING_TYPE_STATIONARY_DETECT "android.sensor.stationary_detect"
-
-/*
- * SENSOR_TYPE_MOTION_DETECT
- * trigger mode: one shot
- *
- * A sensor of this type returns an event if the device is not still for
- * a while. The period of time to monitor for statinarity should be greater than
- * 5 seconds, and less than 10 seconds.
- *
- * Motion here refers to any mechanism in which the device is causes to be
- * moved in its inertial frame. eg: Pickin up the device and walking with it
- * to a nearby room may trigger motion wherewas keeping the device on a table
- * on a smooth train moving at constant velocity may not trigger motion.
- *
- * The only allowed value to return is 1.0.
- */
-#define SENSOR_TYPE_MOTION_DETECT (30)
#define SENSOR_STRING_TYPE_MOTION_DETECT "android.sensor.motion_detect"
-
-/*
- * SENSOR_TYPE_HEART_BEAT
- * trigger mode: continuous
- *
- * A sensor of this type returns an event everytime a hear beat peak is
- * detected.
- *
- * Peak here ideally corresponds to the positive peak in the QRS complex of
- * and ECG signal.
- *
- * The sensor is not expected to be optimized for latency. As a guide, a
- * latency of up to 10 seconds is acceptable. However the timestamp attached
- * to the event should be accurate and should correspond to the time the peak
- * occured.
- *
- * The sensor event contains a parameter for the confidence in the detection
- * of the peak where 0.0 represent no information at all, and 1.0 represents
- * certainty.
- */
-#define SENSOR_TYPE_HEART_BEAT (31)
#define SENSOR_STRING_TYPE_HEART_BEAT "android.sensor.heart_beat"
-
-/**
- * SENSOR_TYPE_DYNAMIC_SENSOR_META
- * trigger-mode: special
- * wake-up sensor: yes
- *
- * A sensor event of this type is received when a dynamic sensor is added to or removed from the
- * system. At most one sensor of this type can be present in one sensor HAL implementation and
- * presence of a sensor of this type in sensor HAL implementation indicates that this sensor HAL
- * supports dynamic sensor feature. Operations, such as batch, activate and setDelay, to this
- * special purpose sensor should be treated as no-op and return successful.
- *
- * A dynamic sensor connection indicates connection of a physical device or instantiation of a
- * virtual sensor backed by algorithm; and a dynamic sensor disconnection indicates the the
- * opposite. A sensor event of SENSOR_TYPE_DYNAMIC_SENSOR_META type should be delivered regardless
- * of the activation status of the sensor in the event of dynamic sensor connection and
- * disconnection. In the sensor event, besides the common data entries, "dynamic_sensor_meta", which
- * includes fields for connection status, handle of the sensor involved, pointer to sensor_t
- * structure and a uuid field, should be populated.
- *
- * At a dynamic sensor connection event, fields of sensor_t structure referenced by a pointer in
- * dynamic_sensor_meta should be filled as if it was regular sensors. Sensor HAL is responsible for
- * recovery of memory if the corresponding data is dynamicially allocated. However, the the pointer
- * must be valid until the first activate call to the sensor reported in this connection event. At a
- * dynamic sensor disconnection, the sensor_t pointer should be NULL.
- *
- * The sensor handle assigned to dynamic sensors should never be the same as that of any regular
- * static sensors, and should be unique until next boot. In another word, if a handle h is used for
- * a dynamic sensor A, that same number cannot be used for the same dynamic sensor A or another
- * dynamic sensor B even after disconnection of A until reboot.
- *
- * The UUID field will be used for identifying the sensor in addition to name, vendor and version
- * and type. For physical sensors of the same model, all sensors will have the same values in
- * sensor_t, but the UUID should be unique and persistent for each individual unit. An all zero UUID
- * indicates it is not possible to differentiate individual sensor unit.
- *
- * It is recommended to implement this type as wake up sensor.
- *
- */
-#define SENSOR_TYPE_DYNAMIC_SENSOR_META (32)
-#define SENSOR_STRING_TYPE_DYNAMIC_SENSOR_META "android.sensor.dynamic_sensor_meta"
-
-/**
- * SENSOR_TYPE_ADDITIONAL_INFO
- * reporting-mode: N/A
- *
- * This sensor type is for delivering additional sensor information aside from sensor event data.
- * Additional information may include sensor front-end group delay, internal calibration parameters,
- * noise level metrics, device internal temperature, etc.
- *
- * This type will never bind to a sensor. In other words, no sensor in the sensor list should be of
- * the type SENSOR_TYPE_ADDITIONAL_INFO. If a sensor HAL supports sensor additional information
- * feature, it reports sensor_event_t with "sensor" field set to handle of the reporting sensor and
- * "type" field set to SENSOR_TYPE_ADDITIONAL_INFO. Delivery of additional information events is
- * triggered under two conditions: an enable activate() call or a flush() call to the corresponding
- * sensor.
- *
- * A single additional information report consists of multiple frames. Sequences of these frames are
- * ordered using timestamps, which means the timestamps of sequential frames have to be at least 1
- * nanosecond apart from each other. Each frame is a sensor_event_t delivered through the HAL
- * interface, with related data stored in the "additional_info" field, which is of type
- * additional_info_event_t. The "type" field of additional_info_event_t denotes the nature of the
- * payload data (see additional_info_type_t). The "serial" field is used to keep the sequence of
- * payload data that spans multiple frames. The first frame of the entire report is always of type
- * AINFO_BEGIN, and the last frame is always AINFO_END.
- *
- * All additional information frames have to be delivered after flush complete event if flush() was
- * triggering the report.
- */
-#define SENSOR_TYPE_ADDITIONAL_INFO (33)
-#define SENSOR_STRING_TYPE_ADDITIONAL_INFO "android.sensor.additional_info"
+#define SENSOR_STRING_TYPE_DYNAMIC_SENSOR_META "android.sensor.dynamic_sensor_meta"
+#define SENSOR_STRING_TYPE_ADDITIONAL_INFO "android.sensor.additional_info"
+#define SENSOR_STRING_TYPE_LOW_LATENCY_OFFBODY_DETECT "android.sensor.low_latency_offbody"
+#define SENSOR_STRING_TYPE_ACCELEROMETER_UNCALIBRATED "android.sensor.accelerometer_uncalibrated"
/**
* Values returned by the accelerometer in various locations in the universe.
@@ -879,16 +199,6 @@
/** Minimum magnetic field on Earth's surface */
#define MAGNETIC_FIELD_EARTH_MIN (30.0f)
-/**
- * Possible values of the status field of sensor events.
- */
-#define SENSOR_STATUS_NO_CONTACT -1
-#define SENSOR_STATUS_UNRELIABLE 0
-#define SENSOR_STATUS_ACCURACY_LOW 1
-#define SENSOR_STATUS_ACCURACY_MEDIUM 2
-#define SENSOR_STATUS_ACCURACY_HIGH 3
-
-
struct sensor_t;
/**
@@ -913,7 +223,7 @@
} sensors_vec_t;
/**
- * uncalibrated gyroscope and magnetometer event data
+ * uncalibrated accelerometer, gyroscope and magnetometer event data
*/
typedef struct {
union {
@@ -980,75 +290,6 @@
};
} additional_info_event_t;
-typedef enum additional_info_type {
- //
- AINFO_BEGIN = 0x0, // Marks the beginning of additional information frames
- AINFO_END = 0x1, // Marks the end of additional information frames
- // Basic information
- AINFO_UNTRACKED_DELAY = 0x10000, // Estimation of the delay that is not tracked by sensor
- // timestamps. This includes delay introduced by
- // sensor front-end filtering, data transport, etc.
- // float[2]: delay in seconds
- // standard deviation of estimated value
- //
- AINFO_INTERNAL_TEMPERATURE, // float: Celsius temperature.
- //
- AINFO_VEC3_CALIBRATION, // First three rows of a homogeneous matrix, which
- // represents calibration to a three-element vector
- // raw sensor reading.
- // float[12]: 3x4 matrix in row major order
- //
- AINFO_SENSOR_PLACEMENT, // Location and orientation of sensor element in the
- // device frame: origin is the geometric center of the
- // mobile device screen surface; the axis definition
- // corresponds to Android sensor definitions.
- // float[12]: 3x4 matrix in row major order
- //
- AINFO_SAMPLING, // float[2]: raw sample period in seconds,
- // standard deviation of sampling period
-
- // Sampling channel modeling information
- AINFO_CHANNEL_NOISE = 0x20000, // int32_t: noise type
- // float[n]: parameters
- //
- AINFO_CHANNEL_SAMPLER, // float[3]: sample period
- // standard deviation of sample period,
- // quantization unit
- //
- AINFO_CHANNEL_FILTER, // Represents a filter:
- // \sum_j a_j y[n-j] == \sum_i b_i x[n-i]
- //
- // int32_t[3]: number of feedforward coefficients, M,
- // number of feedback coefficients, N, for
- // FIR filter, N=1.
- // bit mask that represents which element to
- // which the filter is applied, bit 0 == 1
- // means this filter applies to vector
- // element 0.
- // float[M+N]: filter coefficients (b0, b1, ..., BM-1),
- // then (a0, a1, ..., aN-1), a0 is always 1.
- // Multiple frames may be needed for higher
- // number of taps.
- //
- AINFO_CHANNEL_LINEAR_TRANSFORM, // int32_t[2]: size in (row, column) ... 1st frame
- // float[n]: matrix element values in row major order.
- //
- AINFO_CHANNEL_NONLINEAR_MAP, // int32_t[2]: extrapolate method
- // interpolate method
- // float[n]: mapping key points in pairs, (in, out)...
- // (may be used to model saturation)
- //
- AINFO_CHANNEL_RESAMPLER, // int32_t: resample method (0-th order, 1st order...)
- // float[1]: resample ratio (upsampling if < 1.0;
- // downsampling if > 1.0).
- //
-
- // Custom information
- AINFO_CUSTOM_START = 0x10000000, //
- // Debugging
- AINFO_DEBUGGING_START = 0x40000000, //
-} additional_info_type_t;
-
/**
* Union of the various types of sensor data
* that can be returned.
@@ -1106,6 +347,9 @@
/* uncalibrated magnetometer values are in micro-Teslas */
uncalibrated_event_t uncalibrated_magnetic;
+ /* uncalibrated accelerometer values are in meter per second per second (m/s^2) */
+ uncalibrated_event_t uncalibrated_accelerometer;
+
/* heart rate data containing value in bpm and status */
heart_rate_event_t heart_rate;
@@ -1228,13 +472,14 @@
*/
uint32_t fifoMaxEventCount;
- /* type of this sensor as a string. Set to corresponding
- * SENSOR_STRING_TYPE_*.
- * When defining an OEM specific sensor or sensor manufacturer specific
- * sensor, use your reserve domain name as a prefix.
- * ex: com.google.glass.onheaddetector
- * For sensors of known type, the android framework might overwrite this
- * string automatically.
+ /* type of this sensor as a string.
+ *
+ * If type is OEM specific or sensor manufacturer specific type
+ * (>=SENSOR_TYPE_DEVICE_PRIVATE_BASE), this string must be defined with reserved domain of
+ * vendor/OEM as a prefix, e.g. com.google.glass.onheaddetector
+ *
+ * For sensors of Android defined types, Android framework will override this value. It is ok to
+ * leave it pointing to an empty string.
*/
const char* stringType;
@@ -1280,6 +525,23 @@
void* reserved[2];
};
+/**
+ * Shared memory information for a direct channel
+ */
+struct sensors_direct_mem_t {
+ int type; // enum SENSOR_DIRECT_MEM_...
+ int format; // enum SENSOR_DIRECT_FMT_...
+ size_t size; // size of the memory region, in bytes
+ const struct native_handle *handle; // shared memory handle, which is interpreted differently
+ // depending on type
+};
+
+/**
+ * Direct channel report configuration
+ */
+struct sensors_direct_cfg_t {
+ int rate_level; // enum SENSOR_DIRECT_RATE_...
+};
/*
* sensors_poll_device_t is used with SENSORS_DEVICE_API_VERSION_0_1
@@ -1336,7 +598,13 @@
int sensor_handle, int64_t sampling_period_ns);
/**
- * Returns an array of sensor data.
+ * Write an array of sensor_event_t to data. The size of the
+ * available buffer is specified by count. Returns number of
+ * valid sensor_event_t.
+ *
+ * This function should block if there is no sensor event
+ * available when being called. Thus, return value should always be
+ * positive.
*/
int (*poll)(struct sensors_poll_device_t *dev,
sensors_event_t* data, int count);
@@ -1381,7 +649,61 @@
*/
int (*inject_sensor_data)(struct sensors_poll_device_1 *dev, const sensors_event_t *data);
- void (*reserved_procs[7])(void);
+ /*
+ * Register/unregister direct report channel.
+ *
+ * A HAL declares support for direct report by setting non-NULL values for both
+ * register_direct_channel and config_direct_report.
+ *
+ * This function has two operation modes:
+ *
+ * Register: mem != NULL, register a channel using supplied shared memory information. By the
+ * time this function returns, sensors must finish initializing shared memory content
+ * (format dependent, see SENSOR_DIRECT_FMT_*).
+ * Parameters:
+ * mem points to a valid struct sensors_direct_mem_t.
+ * channel_handle is ignored.
+ * Return value:
+ * A handle of channel (>0, <INT32_MAX) when success, which later can be referred in
+ * unregister or config_direct_report call, or error code (<0) when failed
+ * Unregister: mem == NULL, unregister a previously registered channel.
+ * Parameters:
+ * mem set to NULL
+ * channel_handle contains handle of channel to be unregistered
+ * Return value:
+ * 0, even if the channel_handle is invalid, in which case it will be a no-op.
+ */
+ int (*register_direct_channel)(struct sensors_poll_device_1 *dev,
+ const struct sensors_direct_mem_t* mem, int channel_handle);
+
+ /*
+ * Configure direct sensor event report in direct channel.
+ *
+ * Start, modify rate or stop direct report of a sensor in a certain direct channel. A special
+ * case is setting sensor handle -1 to stop means to stop all active sensor report on the
+ * channel specified.
+ *
+ * A HAL declares support for direct report by setting non-NULL values for both
+ * register_direct_channel and config_direct_report.
+ *
+ * Parameters:
+ * sensor_handle sensor to be configured. The sensor has to support direct report
+ * mode by setting flags of sensor_t. Also, direct report mode is only
+ * defined for continuous reporting mode sensors.
+ * channel_handle channel handle to be configured.
+ * config direct report parameters, see sensor_direct_cfg_t.
+ * Return value:
+ * - when sensor is started or sensor rate level is changed: return positive identifier of
+ * sensor in specified channel if successful, otherwise return negative error code.
+ * - when sensor is stopped: return 0 for success or negative error code for failure.
+ */
+ int (*config_direct_report)(struct sensors_poll_device_1 *dev,
+ int sensor_handle, int channel_handle, const struct sensors_direct_cfg_t *config);
+
+ /*
+ * Reserved for future use.
+ */
+ void (*reserved_procs[5])(void);
} sensors_poll_device_1_t;
diff --git a/include/hardware/vehicle.h b/include/hardware/vehicle.h
index a590fbd..8b28e7a 100644
--- a/include/hardware/vehicle.h
+++ b/include/hardware/vehicle.h
@@ -83,7 +83,6 @@
/**
* Invalid property value used for argument where invalid property gives different result.
- * @range_start
*/
#define VEHICLE_PROPERTY_INVALID (0x0)
@@ -122,7 +121,7 @@
* @data_member info_model_year
* @unit VEHICLE_UNIT_TYPE_YEAR
*/
-#define VEHICLE_PROPERTY_INFO_MODEL_YEAR (0x00000103)
+#define VEHICLE_PROPERTY_INFO_MODEL_YEAR (0x00000103)
/**
* Fuel capacity of the vehicle
@@ -253,7 +252,7 @@
- //==== HVAC Properties ====
+//==== HVAC Properties ====
/**
* Fan speed setting
@@ -261,8 +260,7 @@
* @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
* @access VEHICLE_PROP_ACCESS_READ_WRITE
* @data_member hvac.fan_speed
- * @zone_type VEHICLE_ZONE
- * @data_enum TODO
+ * @zone_type VEHICLE_ZONE_TYPE_ZONE
* @allow_out_of_range_value : OFF
*/
#define VEHICLE_PROPERTY_HVAC_FAN_SPEED (0x00000500)
@@ -273,8 +271,8 @@
* @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
* @access VEHICLE_PROP_ACCESS_READ_WRITE
* @data_member hvac.fan_direction
- * @zone_type VEHICLE_ZONE
- * @data_enum TODO
+ * @zone_type VEHICLE_ZONE_TYPE_ZONE
+ * @data_enum vehicle_hvac_fan_direction
* @allow_out_of_range_value : OFF
*/
#define VEHICLE_PROPERTY_HVAC_FAN_DIRECTION (0x00000501)
@@ -293,9 +291,9 @@
/**
* HVAC current temperature.
* @value_type VEHICLE_VALUE_TYPE_ZONED_FLOAT
- * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
* @access VEHICLE_PROP_ACCESS_READ_WRITE
- * @zone_type VEHICLE_ZONE
+ * @zone_type VEHICLE_ZONE_TYPE_ZONE
* @data_member hvac.temperature_current
*/
#define VEHICLE_PROPERTY_HVAC_TEMPERATURE_CURRENT (0x00000502)
@@ -303,9 +301,9 @@
/**
* HVAC, target temperature set.
* @value_type VEHICLE_VALUE_TYPE_ZONED_FLOAT
- * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
* @access VEHICLE_PROP_ACCESS_READ_WRITE
- * @zone_type VEHICLE_ZONE
+ * @zone_type VEHICLE_ZONE_TYPE_ZONE
* @data_member hvac.temperature_set
* @allow_out_of_range_value : MIN / MAX / OFF
*/
@@ -316,7 +314,7 @@
* @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
* @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
* @access VEHICLE_PROP_ACCESS_READ_WRITE
- * @zone_type VEHICLE_WINDOW
+ * @zone_type VEHICLE_ZONE_TYPE_WINDOW
* @data_member hvac.defrost_on
*/
#define VEHICLE_PROPERTY_HVAC_DEFROSTER (0x00000504)
@@ -327,7 +325,7 @@
* @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
* @access VEHICLE_PROP_ACCESS_READ_WRITE
* @config_flags Supported zones
- * @zone_type VEHICLE_ZONE
+ * @zone_type VEHICLE_ZONE_TYPE_ZONE
* @data_member hvac.ac_on
*/
#define VEHICLE_PROPERTY_HVAC_AC_ON (0x00000505)
@@ -337,7 +335,7 @@
* @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
* @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
* @access VEHICLE_PROP_ACCESS_READ_WRITE
- * @zone_type VEHICLE_ZONE
+ * @zone_type VEHICLE_ZONE_TYPE_ZONE
* @data_member hvac.max_ac_on
*/
#define VEHICLE_PROPERTY_HVAC_MAX_AC_ON (0x00000506)
@@ -347,7 +345,7 @@
* @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
* @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
* @access VEHICLE_PROP_ACCESS_READ_WRITE
- * @zone_type VEHICLE_ZONE
+ * @zone_type VEHICLE_ZONE_TYPE_ZONE
* @data_member hvac.max_defrost_on
*/
#define VEHICLE_PROPERTY_HVAC_MAX_DEFROST_ON (0x00000507)
@@ -357,7 +355,7 @@
* @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
* @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
* @access VEHICLE_PROP_ACCESS_READ_WRITE
- * @zone_type VEHICLE_ZONE
+ * @zone_type VEHICLE_ZONE_TYPE_ZONE
* @data_member hvac.max_recirc_on
*/
#define VEHICLE_PROPERTY_HVAC_RECIRC_ON (0x00000508)
@@ -367,12 +365,94 @@
* @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
* @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
* @access VEHICLE_PROP_ACCESS_READ_WRITE
- * @zone_type VEHICLE_ZONE
+ * @zone_type VEHICLE_ZONE_TYPE_ZONE
* @data_member hvac.dual_on
*/
#define VEHICLE_PROPERTY_HVAC_DUAL_ON (0x00000509)
/**
+ * On/off automatic mode
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_ZONE
+ * @data_member hvac.auto_on
+ */
+#define VEHICLE_PROPERTY_HVAC_AUTO_ON (0x0000050A)
+
+/**
+ * Seat temperature
+ *
+ * Negative values indicate cooling.
+ * 0 indicates off.
+ * Positive values indicate heating.
+ *
+ * Some vehicles may have multiple levels of heating and cooling. The min/max
+ * range defines the allowable range and number of steps in each direction.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_HVAC_SEAT_TEMPERATURE (0x0000050B)
+
+/**
+ * Side Mirror Heat
+ *
+ * Increase values denote higher heating levels for side mirrors.
+ * 0 indicates heating is turned off.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_HVAC_SIDE_MIRROR_HEAT (0x0000050C)
+
+/**
+ * Steering Wheel Temperature
+ *
+ * Sets the temperature for the steering wheel
+ * Positive value indicates heating.
+ * Negative value indicates cooling.
+ * 0 indicates tempreature control is off.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_HVAC_STEERING_WHEEL_TEMP (0x0000050D)
+
+/**
+ * Temperature units
+ *
+ * Indicates whether the temperature is in Celsius, Fahrenheit, or a different unit.
+ * This parameter affects all HVAC temperatures in the system.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ
+ * @data_enum vehicle_unit_type
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_HVAC_TEMPERATURE_UNITS (0x0000050E)
+
+/**
+ * Actual fan speed
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ
+ * @data_member hvac.fan_speed
+ * @zone_type VEHICLE_ZONE_TYPE_ZONE
+ * @allow_out_of_range_value : OFF
+ */
+#define VEHICLE_PROPERTY_HVAC_ACTUAL_FAN_SPEED_RPM (0x0000050F)
+
+
+/**
* Represents power state for HVAC. Some HVAC properties will require matching power to be turned on
* to get out of OFF state. For non-zoned HVAC properties, VEHICLE_ALL_ZONE corresponds to
* global power state.
@@ -383,12 +463,31 @@
* @config_string list of HVAC properties whose power is controlled by this property. Format is
* hexa-decimal number (0x...) separated by comma like "0x500,0x503". All zones
* defined in these affected properties should be available in the property.
- * @zone_type VEHICLE_ZONE
+ * @zone_type VEHICLE_ZONE_TYPE_ZONE
* @data_member hvac.power_on
*/
#define VEHICLE_PROPERTY_HVAC_POWER_ON (0x00000510)
/**
+ * Fan Positions Available
+ *
+ * This is a bit mask of fan positions available for the zone. Each entry in
+ * vehicle_hvac_fan_direction is selected by bit position. For instance, if
+ * only the FAN_DIRECTION_FACE (0x1) and FAN_DIRECTION_DEFROST (0x4) are available,
+ * then this value shall be set to 0x12.
+ *
+ * 0x12 = (1 << 1) | (1 << 4)
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC
+ * @access VEHICLE_PROP_ACCESS_READ
+ * @data_member int32_value
+ * @zone_type VEHICLE_ZONE_TYPE_ZONE
+ * @allow_out_of_range_value : OFF
+ */
+#define VEHICLE_PROPERTY_HVAC_FAN_DIRECTION_AVAILABLE (0x00000511)
+
+/**
* Outside temperature
* @value_type VEHICLE_VALUE_TYPE_FLOAT
* @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS
@@ -396,8 +495,7 @@
* @data_member outside_temperature
* @unit VEHICLE_UNIT_TYPE_CELCIUS
*/
-
-#define VEHICLE_PROPERTY_ENV_OUTSIDE_TEMPERATURE (0x00000703)
+#define VEHICLE_PROPERTY_ENV_OUTSIDE_TEMPERATURE (0x00000703)
/**
@@ -408,7 +506,7 @@
* @data_member cabin_temperature
* @unit VEHICLE_UNIT_TYPE_CELCIUS
*/
-#define VEHICLE_PROPERTY_ENV_CABIN_TEMPERATURE (0x00000704)
+#define VEHICLE_PROPERTY_ENV_CABIN_TEMPERATURE (0x00000704)
/*
@@ -434,7 +532,7 @@
* @config_flags Number of presets supported
* @data_member int32_array
*/
-#define VEHICLE_PROPERTY_RADIO_PRESET (0x0000801)
+#define VEHICLE_PROPERTY_RADIO_PRESET (0x00000801)
/**
* Constants relevant to radio.
@@ -492,7 +590,13 @@
* VEHICLE_AUDIO_EXT_FOCUS_CAR_PERMANENT when car side is playing something
* permanent.
* LOSS_TRANSIENT: always should be VEHICLE_AUDIO_EXT_FOCUS_CAR_TRANSIENT
- * int32_array[3]: should be zero.
+ * int32_array[3]: context requested by android side when responding to focus request.
+ * When car side is taking focus away, this should be zero.
+ *
+ * A focus response should be sent per each focus request even if there is no change in
+ * focus state. This can happen in case like focus request only involving context change
+ * where android side still needs matching focus response to confirm that audio module
+ * has made necessary changes.
*
* If car does not support VEHICLE_PROPERTY_AUDIO_FOCUS, focus is assumed to be granted always.
*
@@ -501,7 +605,7 @@
* @access VEHICLE_PROP_ACCESS_READ_WRITE
* @data_member int32_array
*/
-#define VEHICLE_PROPERTY_AUDIO_FOCUS (0x00000900)
+#define VEHICLE_PROPERTY_AUDIO_FOCUS (0x00000900)
enum vehicle_audio_focus_request {
VEHICLE_AUDIO_FOCUS_REQUEST_GAIN = 0x1,
@@ -638,13 +742,23 @@
VEHICLE_AUDIO_CONTEXT_SYSTEM_SOUND_FLAG = 0x400,
/** Radio is played */
VEHICLE_AUDIO_CONTEXT_RADIO_FLAG = 0x800,
+ /** Ext source is played. This is for tagging generic ext sources. */
+ VEHICLE_AUDIO_CONTEXT_EXT_SOURCE_FLAG = 0x1000,
};
/**
* Property to control audio volume of each audio context.
*
+ * vehicle_prop_config_t
+ * config_array[0] : bit flags of all supported audio contexts. If this is 0,
+ * audio volume is controlled per physical stream
+ * config_array[1] : flags defined in vehicle_audio_volume_capability_flag to
+ * represent audio module's capability.
+ *
* Data type looks like:
- * int32_array[0] : stream context as defined in vehicle_audio_context_flag.
+ * int32_array[0] : stream context as defined in vehicle_audio_context_flag. If only physical
+ stream is supported (config_array[0] == 0), this will represent physical
+ stream number.
* int32_array[1] : volume level, valid range is 0 to int32_max_value defined in config.
* 0 will be mute state. int32_min_value in config should be always 0.
* int32_array[2] : One of vehicle_audio_volume_state.
@@ -658,7 +772,34 @@
* @config_flags all audio contexts supported.
* @data_member int32_array
*/
-#define VEHICLE_PROPERTY_AUDIO_VOLUME (0x00000901)
+#define VEHICLE_PROPERTY_AUDIO_VOLUME (0x00000901)
+
+
+/**
+ * flags to represent capability of audio volume property.
+ * used in config_array[1] of vehicle_prop_config_t.
+ */
+enum vehicle_audio_volume_capability_flag {
+ /**
+ * External audio module or vehicle hal has persistent storage
+ * to keep the volume level. This should be set only when per context
+ * volume level is supproted. When this is set, audio volume level per
+ * each context will be retrieved from the property when systen starts up.
+ * And external audio module is also expected to adjust volume automatically
+ * whenever there is an audio context change.
+ * When this flag is not set, android side will assume that there is no
+ * persistent storage and stored value in android side will be used to
+ * initialize the volume level. And android side will set volume level
+ * of each physical streams whenever there is an audio context change.
+ */
+ VEHICLE_AUDIO_VOLUME_CAPABILITY_PERSISTENT_STORAGE = 0x1,
+ /**
+ * When this flag is set, the H/W can support only single master volume for all streams.
+ * There is no way to set volume level differently per each stream or context.
+ */
+ VEHICLE_AUDIO_VOLUME_CAPABILITY_MASTER_VOLUME_ONLY = 0x2,
+};
+
/**
* enum to represent audio volume state.
@@ -683,8 +824,18 @@
/**
* Property for handling volume limit set by user. This limits maximum volume that can be set
- * per each context.
- * int32_array[0] : stream context as defined in vehicle_audio_context_flag.
+ * per each context or physical stream.
+ *
+ * vehicle_prop_config_t
+ * config_array[0] : bit flags of all supported audio contexts. If this is 0,
+ * audio volume is controlled per physical stream
+ * config_array[1] : flags defined in vehicle_audio_volume_capability_flag to
+ * represent audio module's capability.
+ *
+ * Data type looks like:
+ * int32_array[0] : stream context as defined in vehicle_audio_context_flag. If only physical
+ * stream is supported (config_array[0] == 0), this will represent physical
+ * stream number.
* int32_array[1] : maximum volume set to the stream. If there is no restriction, this value
* will be bigger than VEHICLE_PROPERTY_AUDIO_VOLUME's max value.
*
@@ -698,7 +849,7 @@
* @config_flags all audio contexts supported.
* @data_member int32_array
*/
-#define VEHICLE_PROPERTY_AUDIO_VOLUME_LIMIT (0x00000902)
+#define VEHICLE_PROPERTY_AUDIO_VOLUME_LIMIT (0x00000902)
/**
* Index in int32_array for VEHICLE_PROPERTY_AUDIO_VOLUME_LIMIT property.
@@ -727,7 +878,7 @@
* @access VEHICLE_PROP_ACCESS_WRITE
* @data_member int32_array
*/
-#define VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY (0x00000903)
+#define VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY (0x00000903)
/**
* Index in int32_array for VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY property.
@@ -750,7 +901,7 @@
* this.
* @data_member int32_value
*/
-#define VEHICLE_PROPERTY_AUDIO_HW_VARIANT (0x00000904)
+#define VEHICLE_PROPERTY_AUDIO_HW_VARIANT (0x00000904)
/**
* Flag to be used in vehicle_prop_config.config_flags for VEHICLE_PROPERTY_AUDIO_HW_VARIANT.
@@ -766,6 +917,70 @@
VEHICLE_AUDIO_HW_VARIANT_FLAG_INTERNAL_RADIO_FLAG = 0x1,
};
+/** audio routing for AM/FM. This should be also be the value when there is only one
+ radio module in the system. */
+#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_RADIO_AM_FM "RADIO_AM_FM"
+/** Should be added only when there is a separate radio module with HD capability. */
+#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_RADIO_AM_FM_HD "RADIO_AM_FM_HD"
+/** For digial audio broadcasting type of radio */
+#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_RADIO_DAB "RADIO_DAB"
+/** For satellite type of radio */
+#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_RADIO_SATELLITE "RADIO_SATELLITE"
+/** For CD or DVD */
+#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_CD_DVD "CD_DVD"
+/** For 1st auxiliary input */
+#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_AUX_IN0 "AUX_IN0"
+/** For 2nd auxiliary input */
+#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_AUX_IN1 "AUX_IN1"
+/** For navigation guidance from outside android */
+#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_EXT_NAV_GUIDANCE "EXT_NAV_GUIDANCE"
+/** For voice command from outside android */
+#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_EXT_VOICE_COMMAND "EXT_VOICE_COMMAND"
+/** For voice call from outside android */
+#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_EXT_VOICE_CALL "EXT_VOICE_CALL"
+/** For safety alert from outside android */
+#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_EXT_SAFETY_ALERT "EXT_SAFETY_ALERT"
+
+/**
+* Property to pass hint on external audio routing. When android side request focus
+* with VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY_FLAG flag, this property will be set
+* before setting AUDIO_FOCUS property as a hint for external audio source routing.
+* Note that setting this property alone should not trigger any change.
+* Audio routing should be changed only when AUDIO_FOCUS property is set. Note that
+* this property allows passing custom value as long as it is defined in config_string.
+* This allows supporting non-standard routing options through this property.
+* It is recommended to use separate name space for custom property to prevent conflict in future
+* android releases.
+* Enabling each external routing option is done by enabling each bit flag for the routing.
+* This property can support up to 128 external routings.
+* To give full flexibility, there is no standard definition for each bit flag and
+* assigning each big flag to specific routing type is decided by config_string.
+* config_string has format of each entry separated by ','
+* and each entry has format of bitFlagPositon:typeString[:physicalStreamNumber].
+* bitFlagPosition: represents which big flag will be set to enable this routing. 0 means
+* LSB in int32_array[0]. 31 will be MSB in int32_array[0]. 127 will MSB in int32_array[3].
+* typeString: string representation of external routing. Some types are already defined
+* in VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_* and use them first before adding something
+* custom. Applications will find each routing using this string.
+* physicalStreamNumber: This part is optional and represents physical stream to android
+* which will be disabled when this routing is enabled. If not specified, this routing
+* should not affect physical streams to android.
+* As an example, let's assume a system with two physical streams, 0 for media and 1 for
+* nav guidance. And let's assume external routing option of am fm radio, external navigation
+* guidance, satellite radio, and one custom. Let's assume that radio and satellite replaces
+* physical stream 0 and external navigation replaces physical stream 1. And bit flag will be
+* assigned in the order listed above. This configuration will look like this in config_string:
+* "0:RADIO_AM_FM:0,1:EXT_NAV_GUIDANCE:1,2:RADIO_SATELLITE:0,3:com.test.SOMETHING_CUSTOM"
+* When android requests RADIO_AM_FM, int32_array[0] will be set to 0x1.
+* When android requests RADIO_SATELLITE + EXT_NAV_GUIDANCE, int32_array[0] will be set to 0x2|0x4.
+*
+* @value_type VEHICLE_VALUE_TYPE_INT32_VEC4
+* @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+* @access VEHICLE_PROP_ACCESS_WRITE|VEHICLE_PROP_ACCESS_READ_WRITE
+* @config_string List of all avaiable external source in the system.
+* @data_member int32_array
+*/
+#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_HINT (0x00000905)
/**
* Property to control power state of application processor.
@@ -788,7 +1003,7 @@
* @config_flags Additional info on power state. Should use vehicle_ap_power_state_config_flag.
* @data_member int32_array
*/
-#define VEHICLE_PROPERTY_AP_POWER_STATE (0x00000A00)
+#define VEHICLE_PROPERTY_AP_POWER_STATE (0x00000A00)
enum vehicle_ap_power_state_config_flag {
/**
@@ -895,7 +1110,7 @@
* @access VEHICLE_PROP_ACCESS_READ|VEHICLE_PROP_ACCESS_READ_WRITE
* @data_member int32
*/
-#define VEHICLE_PROPERTY_DISPLAY_BRIGHTNESS (0x00000A01)
+#define VEHICLE_PROPERTY_DISPLAY_BRIGHTNESS (0x00000A01)
/**
@@ -999,7 +1214,7 @@
* @config_array 0:vehicle_instument_cluster_type 1:hw type
* @data_member int32_array
*/
-#define VEHICLE_PROPERTY_INSTRUMENT_CLUSTER_INFO (0x00000A20)
+#define VEHICLE_PROPERTY_INSTRUMENT_CLUSTER_INFO (0x00000A20)
/**
* Represents instrument cluster type available in system
@@ -1019,6 +1234,624 @@
};
/**
+ * Current date and time, encoded as Unix time.
+ * This value denotes the number of seconds that have elapsed since 1/1/1970.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_INT64
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_SET
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @data_member int64_value
+ * @unit VEHICLE_UNIT_TYPE_SECS
+ */
+#define VEHICLE_PROPERTY_UNIX_TIME (0x00000A30)
+
+/**
+ * Current time only.
+ * Some vehicles may not keep track of date. This property only affects the current time, in
+ * seconds during the day. Thus, the max value for this parameter is 86,400 (24 * 60 * 60)
+ *
+ * @value_type VEHICLE_VALUE_TYPE_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_SET
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @data_member int32_value
+ * @unit VEHICLE_UNIT_TYPE_SECS
+ */
+#define VEHICLE_PROPERTY_CURRENT_TIME_IN_SECONDS (0x00000A31)
+
+
+//==== Car Cabin Properties ====
+/**
+ * Most Car Cabin properties have both a MOVE and POSITION parameter associated with them.
+ *
+ * The MOVE parameter will start moving the device in the indicated direction. The magnitude
+ * indicates the relative speed. For instance, setting the WINDOW_MOVE parameter to +1 will roll
+ * the window up. Setting it to +2 (if available) will roll it up faster.
+ *
+ * The POSITION parameter will move the device to the desired position. For instance, if the
+ * WINDOW_POS has a range of 0-100, then setting this parameter to 50 will open the window halfway.
+ * Depending upon the initial position, the window may move up or down to the 50% value.
+ *
+ * OEMs may choose to implement one or both of the MOVE/POSITION parameters depending upon the
+ * capability of the hardware.
+ */
+
+// Doors
+/**
+ * Door position
+ *
+ * This is an integer in case a door may be set to a particular position. Max
+ * value indicates fully open, min value (0) indicates fully closed.
+ *
+ * Some vehicles (minivans) can open the door electronically. Hence, the ability
+ * to write this property.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_DOOR
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_DOOR_POS (0x00000B00)
+
+/**
+ * Door move
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_DOOR
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_DOOR_MOVE (0x00000B01)
+
+
+/**
+ * Door lock
+ *
+ * 'true' indicates door is locked
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_DOOR
+ * @data_member boolean_value
+ */
+#define VEHICLE_PROPERTY_DOOR_LOCK (0x00000B02)
+
+// Mirrors
+/**
+ * Mirror Z Position
+ *
+ * Positive value indicates tilt upwards, negative value is downwards
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_MIRROR
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_MIRROR_Z_POS (0x00000B40)
+
+/**
+ * Mirror Z Move
+ *
+ * Positive value indicates tilt upwards, negative value is downwards
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_MIRROR
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_MIRROR_Z_MOVE (0x00000B41)
+
+/**
+ * Mirror Y Position
+ *
+ * Positive value indicate tilt right, negative value is left
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_MIRROR
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_MIRROR_Y_POS (0x00000B42)
+
+/**
+ * Mirror Y Move
+ *
+ * Positive value indicate tilt right, negative value is left
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_MIRROR
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_MIRROR_Y_MOVE (0x00000B43)
+
+/**
+ * Mirror Lock
+ *
+ * True indicates mirror positions are locked and not changeable
+ *
+ * @value_type VEHICLE_VALUE_TYPE_BOOLEAN
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @data_member boolean_value
+ */
+#define VEHICLE_PROPERTY_MIRROR_LOCK (0x00000B44)
+
+/**
+ * Mirror Fold
+ *
+ * True indicates mirrors are folded
+ *
+ * @value_type VEHICLE_VALUE_TYPE_BOOLEAN
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @data_member boolean_value
+ */
+#define VEHICLE_PROPERTY_MIRROR_FOLD (0x00000B45)
+
+// Seats
+/**
+ * Seat memory select
+ *
+ * This parameter selects the memory preset to use to select the seat position.
+ * The minValue is always 0, and the maxValue determines the number of seat
+ * positions available.
+ *
+ * For instance, if the driver's seat has 3 memory presets, the maxValue will be 3.
+ * When the user wants to select a preset, the desired preset number (1, 2, or 3)
+ * is set.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_MEMORY_SELECT (0x00000B80)
+
+/**
+ * Seat memory set
+ *
+ * This setting allows the user to save the current seat position settings into
+ * the selected preset slot. The maxValue for each seat position shall match
+ * the maxValue for VEHICLE_PROPERTY_SEAT_MEMORY_SELECT.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_MEMORY_SET (0x00000B81)
+
+/**
+ * Seatbelt buckled
+ *
+ * True indicates belt is buckled.
+ *
+ * Write access indicates automatic seat buckling capabilities. There are no known cars at this
+ * time, but you never know...
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member boolean_value
+ */
+#define VEHICLE_PROPERTY_SEAT_BELT_BUCKLED (0x00000B82)
+
+/**
+ * Seatbelt height position
+ *
+ * Adjusts the shoulder belt anchor point.
+ * Max value indicates highest position
+ * Min value indicates lowest position
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_BELT_HEIGHT_POS (0x00000B83)
+
+/**
+ * Seatbelt height move
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_BELT_HEIGHT_MOVE (0x00000B84)
+
+/**
+ * Seat fore/aft position
+ *
+ * Sets the seat position forward (closer to steering wheel) and backwards.
+ * Max value indicates closest to wheel, min value indicates most rearward
+ * position.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_FORE_AFT_POS (0x00000B85)
+
+/**
+ * Seat fore/aft move
+ *
+ * Moves the seat position forward and aft.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_FORE_AFT_MOVE (0x00000B86)
+
+/**
+ * Seat backrest angle 1 position
+ *
+ * Backrest angle 1 is the actuator closest to the bottom of the seat.
+ * Max value indicates angling forward towards the steering wheel.
+ * Min value indicates full recline.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_1_POS (0x00000B87)
+
+/**
+ * Seat backrest angle 1 move
+ *
+ * Moves the backrest forward or recline.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_1_MOVE (0x00000B88)
+
+/**
+ * Seat backrest angle 2 position
+ *
+ * Backrest angle 2 is the next actuator up from the bottom of the seat.
+ * Max value indicates angling forward towards the steering wheel.
+ * Min value indicates full recline.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_2_POS (0x00000B89)
+
+/**
+ * Seat backrest angle 2 move
+ *
+ * Moves the backrest forward or recline.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_2_MOVE (0x00000B8A)
+
+/**
+ * Seat height position
+ *
+ * Sets the seat height.
+ * Max value indicates highest position.
+ * Min value indicates lowest position.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_HEIGHT_POS (0x00000B8B)
+
+/**
+ * Seat height move
+ *
+ * Moves the seat height.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_HEIGHT_MOVE (0x00000B8C)
+
+/**
+ * Seat depth position
+ *
+ * Sets the seat depth, distance from back rest to front edge of seat.
+ * Max value indicates longest depth position.
+ * Min value indicates shortest position.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_DEPTH_POS (0x00000B8D)
+
+/**
+ * Seat depth move
+ *
+ * Adjusts the seat depth.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_DEPTH_MOVE (0x00000B8E)
+
+/**
+ * Seat tilt position
+ *
+ * Sets the seat tilt.
+ * Max value indicates front edge of seat higher than back edge.
+ * Min value indicates front edge of seat lower than back edge.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_TILT_POS (0x00000B8F)
+
+/**
+ * Seat tilt move
+ *
+ * Tilts the seat.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_TILT_MOVE (0x00000B90)
+
+/**
+ * Lumber fore/aft position
+ *
+ * Pushes the lumbar support forward and backwards
+ * Max value indicates most forward position.
+ * Min value indicates most rearward position.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_LUMBAR_FORE_AFT_POS (0x00000B91)
+
+/**
+ * Lumbar fore/aft move
+ *
+ * Adjusts the lumbar support.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_LUMBAR_FORE_AFT_MOVE (0x00000B92)
+
+/**
+ * Lumbar side support position
+ *
+ * Sets the amount of lateral lumbar support.
+ * Max value indicates widest lumbar setting (i.e. least support)
+ * Min value indicates thinnest lumbar setting.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_LUMBAR_SIDE_SUPPORT_POS (0x00000B93)
+
+/**
+ * Lumbar side support move
+ *
+ * Adjusts the amount of lateral lumbar support.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_LUMBAR_SIDE_SUPPORT_MOVE (0x00000B94)
+
+/**
+ * Headrest height position
+ *
+ * Sets the headrest height.
+ * Max value indicates tallest setting.
+ * Min value indicates shortest setting.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_HEADREST_HEIGHT_POS (0x00000B95)
+
+/**
+ * Headrest height move
+ *
+ * Moves the headrest up and down.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_HEADREST_HEIGHT_MOVE (0x00000B96)
+
+/**
+ * Headrest angle position
+ *
+ * Sets the angle of the headrest.
+ * Max value indicates most upright angle.
+ * Min value indicates shallowest headrest angle.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_HEADREST_ANGLE_POS (0x00000B97)
+
+/**
+ * Headrest angle move
+ *
+ * Adjusts the angle of the headrest
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_HEADREST_ANGLE_MOVE (0x00000B98)
+
+/**
+ * Headrest fore/aft position
+ *
+ * Adjusts the headrest forwards and backwards.
+ * Max value indicates position closest to front of car.
+ * Min value indicates position closest to rear of car.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_HEADREST_FORE_AFT_POS (0x00000B99)
+
+/**
+ * Headrest fore/aft move
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @zone_type VEHICLE_ZONE_TYPE_SEAT
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_SEAT_HEADREST_FORE_AFT_MOVE (0x00000B9A)
+
+
+// Windows
+/**
+ * Window Position
+ *
+ * Max = window up / closed
+ * Min = window down / open
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_WINDOW_POS (0x00000BC0)
+
+/**
+ * Window Move
+ *
+ * Max = window up / closed
+ * Min = window down / open
+ * Magnitude denotes relative speed. I.e. +2 is faster than +1 in raising the window.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_WINDOW_MOVE (0x00000BC1)
+
+/**
+ * Window Vent Position
+ *
+ * This feature is used to control the vent feature on a sunroof.
+ *
+ * Max = vent open
+ * Min = vent closed
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_WINDOW_VENT_POS (0x00000BC2)
+
+/**
+ * Window Vent Move
+ *
+ * This feature is used to control the vent feature on a sunroof.
+ *
+ * Max = vent open
+ * Min = vent closed
+ *
+ * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
+ * @data_member int32_value
+ */
+#define VEHICLE_PROPERTY_WINDOW_VENT_MOVE (0x00000BC3)
+
+/**
+ * Window Lock
+ *
+ * True indicates windows are locked and can't be moved.
+ *
+ * @value_type VEHICLE_VALUE_TYPE_BOOLEAN
+ * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
+ * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * @data_member boolean_value
+ */
+#define VEHICLE_PROPERTY_WINDOW_LOCK (0x00000BC4)
+
+
+
+/**
* H/W specific, non-standard property can be added as necessary. Such property should use
* property number in range of [VEHICLE_PROPERTY_CUSTOM_START, VEHICLE_PROPERTY_CUSTOM_END].
* Definition of property in this range is completely up to each HAL implementation.
@@ -1027,20 +1860,20 @@
* include config_string of "com.XYZ.some_further_details".
* @range_start
*/
-#define VEHICLE_PROPERTY_CUSTOM_START (0x70000000)
+#define VEHICLE_PROPERTY_CUSTOM_START (0x70000000)
/** @range_end */
-#define VEHICLE_PROPERTY_CUSTOM_END (0x73ffffff)
+#define VEHICLE_PROPERTY_CUSTOM_END (0x73ffffff)
/**
* Property range allocated for system's internal usage like testing. HAL should never declare
* property in this range.
* @range_start
*/
-#define VEHICLE_PROPERTY_INTERNAL_START (0x74000000)
+#define VEHICLE_PROPERTY_INTERNAL_START (0x74000000)
/**
* @range_end
*/
-#define VEHICLE_PROPERTY_INTERNAL_END (0x74ffffff)
+#define VEHICLE_PROPERTY_INTERNAL_END (0x74ffffff)
/**
* Value types for various properties.
@@ -1086,12 +1919,14 @@
VEHICLE_UNIT_TYPE_METER = 0x00000021,
VEHICLE_UNIT_TYPE_KILOMETER = 0x00000023,
// temperature
- VEHICLE_UNIT_TYPE_CELCIUS = 0x00000030,
+ VEHICLE_UNIT_TYPE_CELSIUS = 0x00000030,
+ VEHICLE_UNIT_TYPE_FAHRENHEIT = 0x00000031,
+ VEHICLE_UNIT_TYPE_KELVIN = 0x00000032,
// volume
VEHICLE_UNIT_TYPE_MILLILITER = 0x00000040,
// time
VEHICLE_UNIT_TYPE_NANO_SECS = 0x00000050,
- VEHICLE_UNOT_TYPE_SECS = 0x00000053,
+ VEHICLE_UNIT_TYPE_SECS = 0x00000053,
VEHICLE_UNIT_TYPE_YEAR = 0x00000059,
};
@@ -1105,8 +1940,12 @@
*/
VEHICLE_PROP_CHANGE_MODE_STATIC = 0x00,
/**
- * Property of this type will be reported when there is a change. get should return the
- * current value.
+ * Property of this type will be reported when there is a change.
+ * get call should return the current value.
+ * Set operation for this property is assumed to be asynchronous. When the property is read
+ * (get) after set, it may still return old value until underlying H/W backing this property
+ * has actually changed the state. Once state is changed, the property will dispatch changed
+ * value as event.
*/
VEHICLE_PROP_CHANGE_MODE_ON_CHANGE = 0x01,
/**
@@ -1114,6 +1953,18 @@
* the data.
*/
VEHICLE_PROP_CHANGE_MODE_CONTINUOUS = 0x02,
+ /**
+ * Property of this type may be polled to get the current value.
+ */
+ VEHICLE_PROP_CHANGE_MODE_POLL = 0x03,
+ /**
+ * This is for property where change event should be sent only when the value is
+ * set from external component. Normal value change will not trigger event.
+ * For example, clock property can send change event only when it is set, outside android,
+ * for case like user setting time or time getting update. There is no need to send it
+ * per every value change.
+ */
+ VEHICLE_PROP_CHANGE_MODE_ON_SET = 0x04,
};
/**
@@ -1238,17 +2089,15 @@
* Various Seats in the car.
*/
enum vehicle_seat {
- VEHICLE_SEAT_DRIVER_LHD = 0x0001,
- VEHICLE_SEAT_DRIVER_RHD = 0x0002,
- VEHICLE_SEAT_ROW_1_PASSENGER_LEFT = 0x0010,
- VEHICLE_SEAT_ROW_1_PASSENGER_CENTER = 0x0020,
- VEHICLE_SEAT_ROW_1_PASSENGER_RIGHT = 0x0040,
- VEHICLE_SEAT_ROW_2_PASSENGER_LEFT = 0x0100,
- VEHICLE_SEAT_ROW_2_PASSENGER_CENTER = 0x0200,
- VEHICLE_SEAT_ROW_2_PASSENGER_RIGHT = 0x0400,
- VEHICLE_SEAT_ROW_3_PASSENGER_LEFT = 0x1000,
- VEHICLE_SEAT_ROW_3_PASSENGER_CENTER = 0x2000,
- VEHICLE_SEAT_ROW_3_PASSENGER_RIGHT = 0x4000
+ VEHICLE_SEAT_ROW_1_LEFT = 0x0001,
+ VEHICLE_SEAT_ROW_1_CENTER = 0x0002,
+ VEHICLE_SEAT_ROW_1_RIGHT = 0x0004,
+ VEHICLE_SEAT_ROW_2_LEFT = 0x0010,
+ VEHICLE_SEAT_ROW_2_CENTER = 0x0020,
+ VEHICLE_SEAT_ROW_2_RIGHT = 0x0040,
+ VEHICLE_SEAT_ROW_3_LEFT = 0x0100,
+ VEHICLE_SEAT_ROW_3_CENTER = 0x0200,
+ VEHICLE_SEAT_ROW_3_RIGHT = 0x0400
};
/**
@@ -1282,6 +2131,7 @@
VEHICLE_MIRROR_DRIVER_RIGHT = 0x00000002,
VEHICLE_MIRROR_DRIVER_CENTER = 0x00000004,
};
+
enum vehicle_turn_signal {
VEHICLE_SIGNAL_NONE = 0x00,
VEHICLE_SIGNAL_RIGHT = 0x01,
@@ -1289,6 +2139,15 @@
VEHICLE_SIGNAL_EMERGENCY = 0x04
};
+enum vehicle_zone_type {
+ VEHICLE_ZONE_TYPE_NONE = 0x00,
+ VEHICLE_ZONE_TYPE_ZONE = 0x01,
+ VEHICLE_ZONE_TYPE_SEAT = 0x02,
+ VEHICLE_ZONE_TYPE_DOOR = 0x04,
+ VEHICLE_ZONE_TYPE_WINDOW = 0x10,
+ VEHICLE_ZONE_TYPE_MIRROR = 0x20,
+};
+
/*
* Boolean type.
*/
@@ -1468,6 +2327,7 @@
vehicle_boolean_t max_defrost_on;
vehicle_boolean_t recirc_on;
vehicle_boolean_t dual_on;
+ vehicle_boolean_t auto_on;
vehicle_boolean_t power_on;
float temperature_current;
diff --git a/include/hardware/vehicle_camera.h b/include/hardware/vehicle_camera.h
index 8075aee..c288796 100644
--- a/include/hardware/vehicle_camera.h
+++ b/include/hardware/vehicle_camera.h
@@ -68,7 +68,7 @@
/**
* Bitmask of features supported by a camera module
*/
-enum {
+typedef enum {
VEHICLE_CAMERA_CONFIG_FLAG_ANDROID_OVERLAY_SUPPORT = 0x1,
VEHICLE_CAMERA_CONFIG_FLAG_CAMERA_CROP_SUPPORT = 0x2,
VEHICLE_CAMERA_CONFIG_FLAG_CAMERA_POSITIONING_SUPPORT = 0x4
@@ -109,7 +109,7 @@
typedef struct vehicle_camera_device_t {
struct hw_device_t common;
- const uint32_t camera_type;
+ uint32_t camera_type;
/**
* Returns the capabilities of this camera.
diff --git a/modules/README.android b/modules/README.android
index 57abb72..7ffc0f4 100644
--- a/modules/README.android
+++ b/modules/README.android
@@ -4,13 +4,13 @@
libhardware.so eventually should contain *just* the HAL hub
(hardware.c), everything in it should be rewritten as modules.
-Modules are .so in /system/libs/hw/ and have a well defined naming
+Modules are .so in /vendor/lib/hw/ and have a well defined naming
convention:
- /system/libs/hw/<*_HARDWARE_MODULE_ID>.<ro.product.board>.so
- /system/libs/hw/<*_HARDWARE_MODULE_ID>.<ro.board.platform>.so
- /system/libs/hw/<*_HARDWARE_MODULE_ID>.<ro.arch>.so
- /system/libs/hw/<*_HARDWARE_MODULE_ID>.default.so
+ /vendor/lib/hw/<*_HARDWARE_MODULE_ID>.<ro.product.board>.so
+ /vendor/lib/hw/<*_HARDWARE_MODULE_ID>.<ro.board.platform>.so
+ /vendor/lib/hw/<*_HARDWARE_MODULE_ID>.<ro.arch>.so
+ /vendor/lib/hw/<*_HARDWARE_MODULE_ID>.default.so
They also have a well defined interface which lives in include/hardware/.
diff --git a/modules/audio/Android.bp b/modules/audio/Android.bp
index 02da2b3..bd23b03 100644
--- a/modules/audio/Android.bp
+++ b/modules/audio/Android.bp
@@ -21,12 +21,13 @@
cc_library_shared {
name: "audio.primary.default",
relative_install_path: "hw",
+ proprietary: true,
srcs: ["audio_hw.c"],
shared_libs: [
"liblog",
"libcutils",
],
- cflags: ["-Wno-unused-parameter"],
+ cflags: ["-Wall", "-Werror", "-Wno-unused-parameter"],
}
// The stub audio HAL module, identical to the default audio hal, but with
@@ -38,12 +39,13 @@
cc_library_shared {
name: "audio.stub.default",
relative_install_path: "hw",
+ proprietary: true,
srcs: ["audio_hw.c"],
shared_libs: [
"liblog",
"libcutils",
],
- cflags: ["-Wno-unused-parameter"],
+ cflags: ["-Wall", "-Werror", "-Wno-unused-parameter"],
}
// The stub audio policy HAL module that can be used as a skeleton for
@@ -51,10 +53,11 @@
cc_library_shared {
name: "audio_policy.stub",
relative_install_path: "hw",
+ proprietary: true,
srcs: ["audio_policy.c"],
shared_libs: [
"liblog",
"libcutils",
],
- cflags: ["-Wno-unused-parameter"],
+ cflags: ["-Wall", "-Werror", "-Wno-unused-parameter"],
}
diff --git a/modules/audio/audio_hw.c b/modules/audio/audio_hw.c
index 35901e4..55a5c3b 100644
--- a/modules/audio/audio_hw.c
+++ b/modules/audio/audio_hw.c
@@ -297,11 +297,9 @@
{
ALOGV("adev_open_output_stream...");
- struct stub_audio_device *ladev = (struct stub_audio_device *)dev;
- struct stub_stream_out *out;
- int ret;
-
- out = (struct stub_stream_out *)calloc(1, sizeof(struct stub_stream_out));
+ *stream_out = NULL;
+ struct stub_stream_out *out =
+ (struct stub_stream_out *)calloc(1, sizeof(struct stub_stream_out));
if (!out)
return -ENOMEM;
@@ -325,11 +323,6 @@
*stream_out = &out->stream;
return 0;
-
-err_open:
- free(out);
- *stream_out = NULL;
- return ret;
}
static void adev_close_output_stream(struct audio_hw_device *dev,
@@ -424,11 +417,8 @@
{
ALOGV("adev_open_input_stream...");
- struct stub_audio_device *ladev = (struct stub_audio_device *)dev;
- struct stub_stream_in *in;
- int ret;
-
- in = (struct stub_stream_in *)calloc(1, sizeof(struct stub_stream_in));
+ *stream_in = NULL;
+ struct stub_stream_in *in = (struct stub_stream_in *)calloc(1, sizeof(struct stub_stream_in));
if (!in)
return -ENOMEM;
@@ -450,11 +440,6 @@
*stream_in = &in->stream;
return 0;
-
-err_open:
- free(in);
- *stream_in = NULL;
- return ret;
}
static void adev_close_input_stream(struct audio_hw_device *dev,
@@ -483,7 +468,6 @@
ALOGV("adev_open: %s", name);
struct stub_audio_device *adev;
- int ret;
if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0)
return -EINVAL;
diff --git a/modules/audio/audio_policy.c b/modules/audio/audio_policy.c
index 9335654..4f9cd5a 100644
--- a/modules/audio/audio_policy.c
+++ b/modules/audio/audio_policy.c
@@ -241,9 +241,7 @@
void *service,
struct audio_policy **ap)
{
- struct default_ap_device *dev;
struct default_audio_policy *dap;
- int ret;
*ap = NULL;
diff --git a/modules/audio_remote_submix/Android.mk b/modules/audio_remote_submix/Android.mk
index 90da396..c9e851f 100644
--- a/modules/audio_remote_submix/Android.mk
+++ b/modules/audio_remote_submix/Android.mk
@@ -18,11 +18,13 @@
LOCAL_MODULE := audio.r_submix.default
LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_PROPRIETARY_MODULE := true
LOCAL_SRC_FILES := \
audio_hw.cpp
LOCAL_C_INCLUDES += \
frameworks/av/include/ \
- frameworks/native/include/
+ frameworks/native/include/ \
+ $(call include-path-for, audio-utils)
LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libnbaio
LOCAL_STATIC_LIBRARIES := libmedia_helper
LOCAL_MODULE_TAGS := optional
diff --git a/modules/camera/3_0/Android.mk b/modules/camera/3_0/Android.mk
new file mode 100644
index 0000000..ae68ed5
--- /dev/null
+++ b/modules/camera/3_0/Android.mk
@@ -0,0 +1,45 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := camera.default
+LOCAL_MODULE_RELATIVE_PATH := hw
+
+LOCAL_C_INCLUDES += \
+ system/core/include \
+ system/media/camera/include \
+
+LOCAL_SRC_FILES := \
+ CameraHAL.cpp \
+ Camera.cpp \
+ ExampleCamera.cpp \
+ Metadata.cpp \
+ Stream.cpp \
+ VendorTags.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ libcamera_metadata \
+ libcutils \
+ liblog \
+ libsync \
+ libutils \
+
+LOCAL_CFLAGS += -Wall -Wextra -fvisibility=hidden
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/camera/Camera.cpp b/modules/camera/3_0/Camera.cpp
similarity index 100%
rename from modules/camera/Camera.cpp
rename to modules/camera/3_0/Camera.cpp
diff --git a/modules/camera/Camera.h b/modules/camera/3_0/Camera.h
similarity index 100%
rename from modules/camera/Camera.h
rename to modules/camera/3_0/Camera.h
diff --git a/modules/camera/CameraHAL.cpp b/modules/camera/3_0/CameraHAL.cpp
similarity index 100%
rename from modules/camera/CameraHAL.cpp
rename to modules/camera/3_0/CameraHAL.cpp
diff --git a/modules/camera/CameraHAL.h b/modules/camera/3_0/CameraHAL.h
similarity index 100%
rename from modules/camera/CameraHAL.h
rename to modules/camera/3_0/CameraHAL.h
diff --git a/modules/camera/ExampleCamera.cpp b/modules/camera/3_0/ExampleCamera.cpp
similarity index 100%
rename from modules/camera/ExampleCamera.cpp
rename to modules/camera/3_0/ExampleCamera.cpp
diff --git a/modules/camera/ExampleCamera.h b/modules/camera/3_0/ExampleCamera.h
similarity index 100%
rename from modules/camera/ExampleCamera.h
rename to modules/camera/3_0/ExampleCamera.h
diff --git a/modules/camera/Metadata.cpp b/modules/camera/3_0/Metadata.cpp
similarity index 100%
rename from modules/camera/Metadata.cpp
rename to modules/camera/3_0/Metadata.cpp
diff --git a/modules/camera/Metadata.h b/modules/camera/3_0/Metadata.h
similarity index 100%
rename from modules/camera/Metadata.h
rename to modules/camera/3_0/Metadata.h
diff --git a/modules/camera/Stream.cpp b/modules/camera/3_0/Stream.cpp
similarity index 100%
rename from modules/camera/Stream.cpp
rename to modules/camera/3_0/Stream.cpp
diff --git a/modules/camera/Stream.h b/modules/camera/3_0/Stream.h
similarity index 100%
rename from modules/camera/Stream.h
rename to modules/camera/3_0/Stream.h
diff --git a/modules/camera/VendorTags.cpp b/modules/camera/3_0/VendorTags.cpp
similarity index 100%
rename from modules/camera/VendorTags.cpp
rename to modules/camera/3_0/VendorTags.cpp
diff --git a/modules/camera/VendorTags.h b/modules/camera/3_0/VendorTags.h
similarity index 100%
rename from modules/camera/VendorTags.h
rename to modules/camera/3_0/VendorTags.h
diff --git a/modules/camera/Android.mk b/modules/camera/Android.mk
index ae68ed5..71388aa 100644
--- a/modules/camera/Android.mk
+++ b/modules/camera/Android.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2012 The Android Open Source Project
+# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,34 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := camera.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-
-LOCAL_C_INCLUDES += \
- system/core/include \
- system/media/camera/include \
-
-LOCAL_SRC_FILES := \
- CameraHAL.cpp \
- Camera.cpp \
- ExampleCamera.cpp \
- Metadata.cpp \
- Stream.cpp \
- VendorTags.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
- libcamera_metadata \
- libcutils \
- liblog \
- libsync \
- libutils \
-
-LOCAL_CFLAGS += -Wall -Wextra -fvisibility=hidden
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
+include $(call all-subdir-makefiles)
diff --git a/modules/consumerir/Android.bp b/modules/consumerir/Android.bp
index bbce6b1..2bbdc04 100644
--- a/modules/consumerir/Android.bp
+++ b/modules/consumerir/Android.bp
@@ -15,6 +15,7 @@
cc_library_shared {
name: "consumerir.default",
relative_install_path: "hw",
+ proprietary: true,
srcs: ["consumerir.c"],
shared_libs: [
"liblog",
diff --git a/modules/fingerprint/Android.bp b/modules/fingerprint/Android.bp
index a66f9f9..ba749e4 100644
--- a/modules/fingerprint/Android.bp
+++ b/modules/fingerprint/Android.bp
@@ -15,6 +15,7 @@
cc_library_shared {
name: "fingerprint.default",
relative_install_path: "hw",
+ proprietary: true,
srcs: ["fingerprint.c"],
shared_libs: ["liblog"],
}
diff --git a/modules/gralloc/Android.mk b/modules/gralloc/Android.mk
index 092e851..cdd8d07 100644
--- a/modules/gralloc/Android.mk
+++ b/modules/gralloc/Android.mk
@@ -20,6 +20,7 @@
include $(CLEAR_VARS)
LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_PROPRIETARY_MODULE := true
LOCAL_SHARED_LIBRARIES := liblog libcutils
LOCAL_SRC_FILES := \
diff --git a/modules/gralloc/gralloc.cpp b/modules/gralloc/gralloc.cpp
index e9559e9..84133fd 100644
--- a/modules/gralloc/gralloc.cpp
+++ b/modules/gralloc/gralloc.cpp
@@ -210,6 +210,9 @@
int bytesPerPixel = 0;
switch (format) {
+ case HAL_PIXEL_FORMAT_RGBA_FP16:
+ bytesPerPixel = 8;
+ break;
case HAL_PIXEL_FORMAT_RGBA_8888:
case HAL_PIXEL_FORMAT_RGBX_8888:
case HAL_PIXEL_FORMAT_BGRA_8888:
diff --git a/modules/hwcomposer/Android.mk b/modules/hwcomposer/Android.mk
index 35c0fae..da0f6db 100644
--- a/modules/hwcomposer/Android.mk
+++ b/modules/hwcomposer/Android.mk
@@ -20,6 +20,7 @@
include $(CLEAR_VARS)
LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_PROPRIETARY_MODULE := true
LOCAL_SHARED_LIBRARIES := liblog libEGL
LOCAL_SRC_FILES := hwcomposer.cpp
LOCAL_MODULE := hwcomposer.default
diff --git a/modules/hwcomposer/hwcomposer.cpp b/modules/hwcomposer/hwcomposer.cpp
index 9d1aa34..7b2e278 100644
--- a/modules/hwcomposer/hwcomposer.cpp
+++ b/modules/hwcomposer/hwcomposer.cpp
@@ -38,18 +38,18 @@
struct hw_device_t** device);
static struct hw_module_methods_t hwc_module_methods = {
- open: hwc_device_open
+ .open = hwc_device_open
};
hwc_module_t HAL_MODULE_INFO_SYM = {
- common: {
- tag: HARDWARE_MODULE_TAG,
- version_major: 1,
- version_minor: 0,
- id: HWC_HARDWARE_MODULE_ID,
- name: "Sample hwcomposer module",
- author: "The Android Open Source Project",
- methods: &hwc_module_methods,
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .version_major = 1,
+ .version_minor = 0,
+ .id = HWC_HARDWARE_MODULE_ID,
+ .name = "Sample hwcomposer module",
+ .author = "The Android Open Source Project",
+ .methods = &hwc_module_methods,
}
};
@@ -68,8 +68,8 @@
l->displayFrame.bottom);
}
-static int hwc_prepare(hwc_composer_device_1_t *dev,
- size_t numDisplays, hwc_display_contents_1_t** displays) {
+static int hwc_prepare(hwc_composer_device_1_t * /*dev*/,
+ size_t /*numDisplays*/, hwc_display_contents_1_t** displays) {
if (displays && (displays[0]->flags & HWC_GEOMETRY_CHANGED)) {
for (size_t i=0 ; i<displays[0]->numHwLayers ; i++) {
//dump_layer(&list->hwLayers[i]);
@@ -79,16 +79,16 @@
return 0;
}
-static int hwc_set(hwc_composer_device_1_t *dev,
- size_t numDisplays, hwc_display_contents_1_t** displays)
+static int hwc_set(hwc_composer_device_1_t * /*dev*/,
+ size_t /*numDisplays*/, hwc_display_contents_1_t** displays)
{
//for (size_t i=0 ; i<list->numHwLayers ; i++) {
// dump_layer(&list->hwLayers[i]);
//}
- EGLBoolean sucess = eglSwapBuffers((EGLDisplay)displays[0]->dpy,
+ EGLBoolean success = eglSwapBuffers((EGLDisplay)displays[0]->dpy,
(EGLSurface)displays[0]->sur);
- if (!sucess) {
+ if (!success) {
return HWC_EGL_ERROR;
}
return 0;
diff --git a/modules/input/evdev/Android.mk b/modules/input/evdev/Android.mk
index 9a5d092..be4db6b 100644
--- a/modules/input/evdev/Android.mk
+++ b/modules/input/evdev/Android.mk
@@ -45,6 +45,7 @@
LOCAL_MODULE := input.evdev.default
LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_PROPRIETARY_MODULE := true
LOCAL_SRC_FILES := \
EvdevModule.cpp
diff --git a/modules/input/evdev/InputHub.cpp b/modules/input/evdev/InputHub.cpp
index 389955d..e2c65fa 100644
--- a/modules/input/evdev/InputHub.cpp
+++ b/modules/input/evdev/InputHub.cpp
@@ -610,7 +610,7 @@
for (;;) {
ssize_t readSize = TEMP_FAILURE_RETRY(read(inputFd, ievs, sizeof(ievs)));
if (readSize == 0 || (readSize < 0 && errno == ENODEV)) {
- ALOGW("could not get event, removed? (fd: %d, size: %d errno: %d)",
+ ALOGW("could not get event, removed? (fd: %d, size: %zd errno: %d)",
inputFd, readSize, errno);
removedDeviceFds.push_back(inputFd);
@@ -621,7 +621,7 @@
}
break;
} else if (readSize % sizeof(input_event) != 0) {
- ALOGE("could not get event. wrong size=%d", readSize);
+ ALOGE("could not get event. wrong size=%zd", readSize);
break;
} else {
size_t count = static_cast<size_t>(readSize) / sizeof(struct input_event);
@@ -702,7 +702,7 @@
if (event->mask & IN_CREATE) {
auto deviceNode = openNode(path);
if (deviceNode == nullptr) {
- ALOGE("could not open device node %s. err=%d", path.c_str(), res);
+ ALOGE("could not open device node %s. err=%zd", path.c_str(), res);
} else {
mInputCallback->onDeviceAdded(deviceNode);
}
diff --git a/modules/local_time/Android.bp b/modules/local_time/Android.bp
index df32325..643afa5 100644
--- a/modules/local_time/Android.bp
+++ b/modules/local_time/Android.bp
@@ -24,6 +24,7 @@
cc_library_shared {
name: "local_time.default",
relative_install_path: "hw",
+ proprietary: true,
srcs: ["local_time_hw.c"],
shared_libs: [
"liblog",
diff --git a/modules/local_time/local_time_hw.c b/modules/local_time/local_time_hw.c
index ac597f4..899c38a 100644
--- a/modules/local_time/local_time_hw.c
+++ b/modules/local_time/local_time_hw.c
@@ -28,6 +28,9 @@
#include <hardware/hardware.h>
#include <hardware/local_time_hal.h>
+// We only support gcc and clang, both of which support this attribute.
+#define UNUSED_ARGUMENT __attribute((unused))
+
struct stub_local_time_device {
struct local_time_hw_device device;
};
@@ -51,7 +54,8 @@
return (int64_t)now;
}
-static uint64_t ltdev_get_local_freq(struct local_time_hw_device* dev)
+static uint64_t ltdev_get_local_freq(
+ struct local_time_hw_device* dev UNUSED_ARGUMENT)
{
// For better or worse, linux clock_gettime routines normalize all clock
// frequencies to 1GHz
diff --git a/modules/nfc-nci/Android.bp b/modules/nfc-nci/Android.bp
index fc73761..90d2a28 100644
--- a/modules/nfc-nci/Android.bp
+++ b/modules/nfc-nci/Android.bp
@@ -15,6 +15,7 @@
cc_library_shared {
name: "nfc_nci.default",
relative_install_path: "hw",
+ proprietary: true,
srcs: ["nfc_nci_example.c"],
shared_libs: [
"liblog",
diff --git a/modules/nfc-nci/nfc_nci_example.c b/modules/nfc-nci/nfc_nci_example.c
index 758c2b7..ea5eb47 100644
--- a/modules/nfc-nci/nfc_nci_example.c
+++ b/modules/nfc-nci/nfc_nci_example.c
@@ -23,44 +23,61 @@
/*
+ * We want to silence the "unused argument" that gcc and clang give.
+ * Other compilers generating this warning will need to provide their
+ * custom attribute to silence this.
+ */
+#if defined(__GNUC__) || defined(__clang__)
+#define UNUSED_ARGUMENT __attribute((unused))
+#else
+#define UNUSED_ARGUMENT
+#endif
+
+/*
* NCI HAL method implementations. These must be overriden
*/
-static int hal_open(const struct nfc_nci_device *dev,
- nfc_stack_callback_t *p_cback, nfc_stack_data_callback_t *p_data_cback) {
+static int hal_open(const struct nfc_nci_device *dev UNUSED_ARGUMENT,
+ nfc_stack_callback_t *p_cback UNUSED_ARGUMENT,
+ nfc_stack_data_callback_t *p_data_cback UNUSED_ARGUMENT) {
ALOGE("NFC-NCI HAL: %s", __FUNCTION__);
return 0;
}
-static int hal_write(const struct nfc_nci_device *dev,
- uint16_t data_len, const uint8_t *p_data) {
+static int hal_write(const struct nfc_nci_device *dev UNUSED_ARGUMENT,
+ uint16_t data_len UNUSED_ARGUMENT,
+ const uint8_t *p_data UNUSED_ARGUMENT) {
ALOGE("NFC-NCI HAL: %s", __FUNCTION__);
return 0;
}
-static int hal_core_initialized(const struct nfc_nci_device *dev,
- uint8_t* p_core_init_rsp_params) {
+static int hal_core_initialized(
+ const struct nfc_nci_device *dev UNUSED_ARGUMENT,
+ uint8_t* p_core_init_rsp_params UNUSED_ARGUMENT) {
ALOGE("NFC-NCI HAL: %s", __FUNCTION__);
return 0;
}
-static int hal_pre_discover(const struct nfc_nci_device *dev) {
+static int hal_pre_discover(
+ const struct nfc_nci_device *dev UNUSED_ARGUMENT) {
ALOGE("NFC-NCI HAL: %s", __FUNCTION__);
return 0;
}
-static int hal_close(const struct nfc_nci_device *dev) {
+static int hal_close(const struct nfc_nci_device *dev UNUSED_ARGUMENT) {
ALOGE("NFC-NCI HAL: %s", __FUNCTION__);
return 0;
}
-static int hal_control_granted (const struct nfc_nci_device *p_dev)
+static int hal_control_granted (
+ const struct nfc_nci_device *p_dev UNUSED_ARGUMENT)
{
ALOGE("NFC-NCI HAL: %s", __FUNCTION__);
return 0;
}
-static int hal_power_cycle (const struct nfc_nci_device *p_dev)
+static int hal_power_cycle (
+ const struct nfc_nci_device *p_dev UNUSED_ARGUMENT)
{
ALOGE("NFC-NCI HAL: %s", __FUNCTION__);
return 0;
diff --git a/modules/nfc/Android.bp b/modules/nfc/Android.bp
index bd93bb5..5f174f4 100644
--- a/modules/nfc/Android.bp
+++ b/modules/nfc/Android.bp
@@ -15,6 +15,7 @@
cc_library_shared {
name: "nfc.default",
relative_install_path: "hw",
+ proprietary: true,
srcs: ["nfc_pn544_example.c"],
shared_libs: [
"liblog",
diff --git a/modules/power/Android.bp b/modules/power/Android.bp
index 2b86c8b..f4c74ce 100644
--- a/modules/power/Android.bp
+++ b/modules/power/Android.bp
@@ -15,6 +15,7 @@
cc_library_shared {
name: "power.default",
relative_install_path: "hw",
+ proprietary: true,
srcs: ["power.c"],
shared_libs: ["liblog"],
}
diff --git a/modules/radio/Android.mk b/modules/radio/Android.mk
index 221424f..6f11169 100644
--- a/modules/radio/Android.mk
+++ b/modules/radio/Android.mk
@@ -21,6 +21,7 @@
LOCAL_MODULE := radio.fm.default
LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_PROPRIETARY_MODULE := true
LOCAL_SRC_FILES := radio_hw.c
LOCAL_SHARED_LIBRARIES := liblog libcutils libradio_metadata
LOCAL_MODULE_TAGS := optional
diff --git a/modules/radio/radio_hal_tool.c b/modules/radio/radio_hal_tool.c
index 05d872e..6c40739 100644
--- a/modules/radio/radio_hal_tool.c
+++ b/modules/radio/radio_hal_tool.c
@@ -131,7 +131,7 @@
radio_metadata_key_t key;
radio_metadata_type_t type;
void *value;
- uint32_t size;
+ size_t size;
radio_metadata_get_at_index(info.metadata, i, &key, &type, &value, &size);
diff --git a/modules/radio/radio_hw.c b/modules/radio/radio_hw.c
index 09f07b1..4010507 100644
--- a/modules/radio/radio_hw.c
+++ b/modules/radio/radio_hw.c
@@ -47,7 +47,7 @@
.bands = {
{
.type = RADIO_BAND_FM,
- .antenna_connected = false,
+ .antenna_connected = true,
.lower_limit = 87900,
.upper_limit = 107900,
.num_spacings = 1,
@@ -209,6 +209,7 @@
*metadata = NULL;
ret = radio_metadata_allocate(metadata, tuner->program.channel, 0);
+
if (ret != 0)
return ret;
@@ -220,14 +221,14 @@
if (ret != 0)
goto exit;
ret = add_bitmap_metadata(metadata, RADIO_METADATA_KEY_ICON, BITMAP_FILE_PATH);
- if (ret != 0)
+ if (ret != 0 && ret != -EPIPE)
goto exit;
ret = radio_metadata_add_clock(metadata, RADIO_METADATA_KEY_CLOCK, &hw_clock);
if (ret != 0)
goto exit;
} else {
ret = add_bitmap_metadata(metadata, RADIO_METADATA_KEY_ART, BITMAP_FILE_PATH);
- if (ret != 0)
+ if (ret != 0 && ret != -EPIPE)
goto exit;
}
@@ -355,6 +356,7 @@
tuner->program.stereo = false;
else
tuner->program.stereo = false;
+ prepare_metadata(tuner, &tuner->program.metadata, tuner->program.tuned);
event.type = RADIO_EVENT_TUNED;
event.info = tuner->program;
@@ -381,6 +383,7 @@
else
tuner->program.stereo = tuner->config.am.stereo;
tuner->program.signal_strength = 50;
+ prepare_metadata(tuner, &tuner->program.metadata, tuner->program.tuned);
event.type = RADIO_EVENT_TUNED;
event.info = tuner->program;
@@ -393,12 +396,7 @@
(tuner->config.spacings[0] * 5)) % 2;
if (tuner->program.tuned) {
- prepare_metadata(tuner, &tuner->program.metadata, true);
send_command_l(tuner, CMD_ANNOUNCEMENTS, 1000, NULL);
- } else {
- if (tuner->program.metadata != NULL)
- radio_metadata_deallocate(tuner->program.metadata);
- tuner->program.metadata = NULL;
}
tuner->program.signal_strength = 100;
if (tuner->config.type == RADIO_BAND_FM)
@@ -407,6 +405,8 @@
else
tuner->program.stereo =
tuner->program.tuned ? tuner->config.am.stereo : false;
+ prepare_metadata(tuner, &tuner->program.metadata, tuner->program.tuned);
+
event.type = RADIO_EVENT_TUNED;
event.info = tuner->program;
send_meta_data = true;
@@ -418,7 +418,6 @@
event.type = RADIO_EVENT_METADATA;
event.metadata = metadata;
}
- send_meta_data = true;
} break;
case CMD_CANCEL: {
@@ -502,6 +501,10 @@
status = -EINVAL;
goto exit;
}
+ if (config->lower_limit > config->upper_limit) {
+ status = -EINVAL;
+ goto exit;
+ }
send_command_l(stub_tuner, CMD_CANCEL, 0, NULL);
send_command_l(stub_tuner, CMD_CONFIG, 500, (void *)config);
@@ -614,7 +617,12 @@
metadata = info->metadata;
*info = stub_tuner->program;
info->metadata = metadata;
- if (metadata != NULL && stub_tuner->program.metadata != NULL)
+ if (metadata == NULL) {
+ ALOGE("%s metadata is a nullptr", __func__);
+ status = -EINVAL;
+ goto exit;
+ }
+ if (stub_tuner->program.metadata != NULL)
radio_metadata_add_metadata(&info->metadata, stub_tuner->program.metadata);
exit:
diff --git a/modules/sensors/Android.bp b/modules/sensors/Android.bp
new file mode 100644
index 0000000..f19cee3
--- /dev/null
+++ b/modules/sensors/Android.bp
@@ -0,0 +1,14 @@
+cc_library_static {
+ name: "multihal",
+ srcs: [
+ "multihal.cpp",
+ "SensorEventQueue.cpp"
+ ],
+ shared_libs: [
+ "liblog",
+ "libcutils",
+ "libutils",
+ "libdl"
+ ],
+ export_include_dirs: ["."],
+}
diff --git a/modules/sensors/Android.mk b/modules/sensors/Android.mk
index 534e6e9..ca277e6 100644
--- a/modules/sensors/Android.mk
+++ b/modules/sensors/Android.mk
@@ -23,6 +23,7 @@
LOCAL_MODULE := sensors.$(TARGET_DEVICE)
LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_PROPRIETARY_MODULE := true
LOCAL_CFLAGS := -DLOG_TAG=\"MultiHal\"
diff --git a/modules/sensors/dynamic_sensor/Android.mk b/modules/sensors/dynamic_sensor/Android.mk
new file mode 100644
index 0000000..07bc5e8
--- /dev/null
+++ b/modules/sensors/dynamic_sensor/Android.mk
@@ -0,0 +1,77 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+COMMON_CFLAGS := -Wall -Werror -Wextra
+
+#
+# There are two ways to utilize the dynamic sensor module:
+# 1. Use as an extension in an existing hal: declare dependency on libdynamic_sensor_ext shared
+# library in existing sensor hal.
+# 2. Use as a standalone sensor HAL and configure multihal to combine it with sensor hal that
+# hosts other sensors: add dependency on sensors.dynamic_sensor_hal in device level makefile and
+# write multihal configuration file accordingly.
+#
+# Please take only one of these two options to avoid conflict over hardware resource.
+#
+
+#
+# Option 1: sensor extension module
+#
+include $(CLEAR_VARS)
+LOCAL_MODULE := libdynamic_sensor_ext
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_OWNER := google
+
+LOCAL_CFLAGS += $(COMMON_CFLAGS) -DLOG_TAG=\"DynamicSensorExt\"
+
+LOCAL_SRC_FILES := \
+ BaseSensorObject.cpp \
+ DynamicSensorManager.cpp \
+ RingBuffer.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libutils \
+ liblog
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
+include $(BUILD_SHARED_LIBRARY)
+
+#
+# Option 2: independent sensor hal
+#
+include $(CLEAR_VARS)
+LOCAL_MODULE := sensors.dynamic_sensor_hal
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_OWNER := google
+
+LOCAL_CFLAGS += $(COMMON_CFLAGS) -DLOG_TAG=\"DynamicSensorHal\"
+
+LOCAL_SRC_FILES := \
+ BaseSensorObject.cpp \
+ DynamicSensorManager.cpp \
+ RingBuffer.cpp \
+ sensors.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libutils \
+ liblog \
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/sensors/dynamic_sensor/BaseDynamicSensorDaemon.h b/modules/sensors/dynamic_sensor/BaseDynamicSensorDaemon.h
new file mode 100644
index 0000000..29cf7a4
--- /dev/null
+++ b/modules/sensors/dynamic_sensor/BaseDynamicSensorDaemon.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_SENSORHAL_EXT_BASE_DYNAMIC_SENSOR_DAEMON_H
+#define ANDROID_SENSORHAL_EXT_BASE_DYNAMIC_SENSOR_DAEMON_H
+
+#include <utils/RefBase.h>
+
+namespace android {
+namespace SensorHalExt {
+
+class DynamicSensorManager;
+
+class BaseDynamicSensorDaemon : public RefBase {
+public:
+ BaseDynamicSensorDaemon(DynamicSensorManager& manager) : mManager(manager) {}
+ virtual ~BaseDynamicSensorDaemon() = default;
+protected:
+ DynamicSensorManager& mManager;
+};
+
+} // namespace SensorHalExt
+} // namespace android
+
+#endif // ANDROID_SENSORHAL_EXT_BASE_DYNAMIC_SENSOR_DAEMON_H
+
diff --git a/modules/sensors/dynamic_sensor/BaseSensorObject.cpp b/modules/sensors/dynamic_sensor/BaseSensorObject.cpp
new file mode 100644
index 0000000..189e87f
--- /dev/null
+++ b/modules/sensors/dynamic_sensor/BaseSensorObject.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BaseSensorObject.h"
+#include "SensorEventCallback.h"
+
+#include <utils/Log.h>
+#include <cstring>
+
+namespace android {
+namespace SensorHalExt {
+
+BaseSensorObject::BaseSensorObject() : mCallback(nullptr) {
+}
+
+bool BaseSensorObject::setEventCallback(SensorEventCallback* callback) {
+ if (mCallback != nullptr) {
+ ALOGE("callback is already assigned, cannot change.");
+ return false;
+ }
+ mCallback = callback;
+ return true;
+}
+
+void BaseSensorObject::getUuid(uint8_t* uuid) const {
+ // default uuid denoting uuid feature is not supported on this sensor.
+ memset(uuid, 0, 16);
+}
+
+int BaseSensorObject::flush() {
+ static const sensors_event_t event = {
+ .type = SENSOR_TYPE_META_DATA,
+ .timestamp = TIMESTAMP_AUTO_FILL // timestamp will be filled at dispatcher
+ };
+ generateEvent(event);
+ return 0;
+}
+
+void BaseSensorObject::generateEvent(const sensors_event_t &e) {
+ if (mCallback) {
+ mCallback->submitEvent(this, e);
+ }
+}
+
+} // namespace SensorHalExt
+} // namespace android
+
diff --git a/modules/sensors/dynamic_sensor/BaseSensorObject.h b/modules/sensors/dynamic_sensor/BaseSensorObject.h
new file mode 100644
index 0000000..326e138
--- /dev/null
+++ b/modules/sensors/dynamic_sensor/BaseSensorObject.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_SENSORHAL_BASE_SENSOR_OBJECT_H
+#define ANDROID_SENSORHAL_BASE_SENSOR_OBJECT_H
+
+#include <utils/RefBase.h>
+#include <utils/Timers.h> // for nsecs_t
+#include <cstdint>
+
+struct sensor_t;
+struct sensors_event_t;
+
+namespace android {
+namespace SensorHalExt {
+
+class SensorEventCallback;
+
+class BaseSensorObject : virtual public RefBase {
+public:
+ BaseSensorObject();
+ virtual ~BaseSensorObject() = default;
+
+ // always called by DynamicSensorManager, callback must point to
+ // valid object throughout life cycle of BaseSensorObject
+ bool setEventCallback(SensorEventCallback* callback);
+
+ // virtual functions to get sensor information and operate sensor
+ virtual const sensor_t* getSensor() const = 0;
+
+ // get uuid of sensor, default implementation set it to all zero, means does not have a uuid.
+ virtual void getUuid(uint8_t* uuid) const;
+
+ // enable sensor
+ virtual int enable(bool enable) = 0;
+
+ // set sample period and batching period of sensor.
+ virtual int batch(nsecs_t samplePeriod, nsecs_t batchPeriod) = 0;
+
+ // flush sensor, default implementation will send a flush complete event back.
+ virtual int flush();
+
+protected:
+ // utility function for sub-class
+ void generateEvent(const sensors_event_t &e);
+private:
+ SensorEventCallback* mCallback;
+};
+
+} // namespace SensorHalExt
+} // namespace android
+
+#endif // ANDROID_SENSORHAL_BASE_SENSOR_OBJECT_H
+
diff --git a/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp b/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
new file mode 100644
index 0000000..d33650c
--- /dev/null
+++ b/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
@@ -0,0 +1,283 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BaseDynamicSensorDaemon.h"
+#include "BaseSensorObject.h"
+#include "DynamicSensorManager.h"
+
+#include <utils/Log.h>
+#include <utils/SystemClock.h>
+
+#include <cassert>
+
+namespace android {
+namespace SensorHalExt {
+
+DynamicSensorManager* DynamicSensorManager::createInstance(
+ int handleBase, int handleCount, SensorEventCallback *callback) {
+ auto m = new DynamicSensorManager(handleBase, handleBase + handleCount - 1, callback);
+ return m;
+}
+
+DynamicSensorManager::DynamicSensorManager(
+ int handleBase, int handleMax, SensorEventCallback* callback) :
+ mHandleRange(handleBase, handleMax),
+ mCallback(callback),
+ mFifo(callback ? 0 : kFifoSize),
+ mNextHandle(handleBase+1) {
+ assert(handleBase > 0 && handleMax > handleBase + 1); // handleBase is reserved
+
+ mMetaSensor = (const sensor_t) {
+ "Dynamic Sensor Manager",
+ "Google",
+ 1, // version
+ handleBase, // handle
+ SENSOR_TYPE_DYNAMIC_SENSOR_META,
+ 1, // maxRange
+ 1, // resolution
+ 1e-6f, // power, very small number instead of 0
+ // to avoid sigularity in app
+ (int32_t)(1000), // minDelay
+ 0, // fifoReservedEventCount
+ 0, // fifoMaxEventCount
+ SENSOR_STRING_TYPE_DYNAMIC_SENSOR_META,
+ "", // requiredPermission
+ (long)(1000), // maxDelay
+ SENSOR_FLAG_SPECIAL_REPORTING_MODE | SENSOR_FLAG_WAKE_UP,
+ { NULL, NULL }
+ };
+}
+
+DynamicSensorManager::~DynamicSensorManager() {
+ // free all daemons first
+ mDaemonVector.clear();
+}
+
+bool DynamicSensorManager::owns(int handle) const {
+ return handle >= mHandleRange.first && handle < mHandleRange.second;
+}
+
+int DynamicSensorManager::activate(int handle, bool enable) {
+ if (handle == mHandleRange.first) {
+ // ignored
+ return 0;
+ }
+
+ // in case there is a pending report, now it is time to remove it as it is no longer necessary.
+ {
+ std::lock_guard<std::mutex> lk(mLock);
+ mPendingReport.erase(handle);
+ }
+
+ return operateSensor(handle,
+ [&enable] (sp<BaseSensorObject> s)->int {
+ return s->enable(enable);
+ });
+}
+
+int DynamicSensorManager::batch(int handle, nsecs_t sample_period, nsecs_t batch_period) {
+ if (handle == mHandleRange.first) {
+ // ignored
+ return 0;
+ }
+ return operateSensor(handle,
+ [&sample_period, &batch_period] (sp<BaseSensorObject> s)->int {
+ return s->batch(sample_period, batch_period);
+ });
+}
+
+int DynamicSensorManager::setDelay(int handle, nsecs_t sample_period) {
+ return batch(handle, sample_period, 0);
+}
+
+int DynamicSensorManager::flush(int handle) {
+ if (handle == mHandleRange.first) {
+ // TODO: submit a flush complete here
+ static const sensors_event_t event = {
+ .type = SENSOR_TYPE_META_DATA,
+ .sensor = mHandleRange.first,
+ .timestamp = TIMESTAMP_AUTO_FILL, // timestamp will be filled at dispatcher
+ };
+ submitEvent(nullptr, event);
+ return 0;
+ }
+ return operateSensor(handle, [] (sp<BaseSensorObject> s)->int {return s->flush();});
+}
+
+int DynamicSensorManager::poll(sensors_event_t * data, int count) {
+ assert(mCallback == nullptr);
+ std::lock_guard<std::mutex> lk(mFifoLock);
+ return mFifo.read(data, count);
+}
+
+bool DynamicSensorManager::registerSensor(sp<BaseSensorObject> sensor) {
+ std::lock_guard<std::mutex> lk(mLock);
+ if (mReverseMap.find(sensor.get()) != mReverseMap.end()) {
+ ALOGE("trying to add the same sensor twice, ignore");
+ return false;
+ }
+ int handle = getNextAvailableHandle();
+ if (handle < 0) {
+ ALOGE("Running out of handle, quit.");
+ return false;
+ }
+
+ // these emplace will always be successful
+ mMap.emplace(handle, sensor);
+ mReverseMap.emplace(sensor.get(), handle);
+ sensor->setEventCallback(this);
+
+ auto entry = mPendingReport.emplace(
+ std::piecewise_construct,
+ std::forward_as_tuple(handle),
+ std::forward_as_tuple(handle, sensor));
+ if (entry.second) {
+ submitEvent(nullptr, entry.first->second.generateConnectionEvent(mHandleRange.first));
+ }
+ return entry.second;
+}
+
+void DynamicSensorManager::unregisterSensor(sp<BaseSensorObject> sensor) {
+ std::lock_guard<std::mutex> lk(mLock);
+ auto i = mReverseMap.find(sensor.get());
+ if (i == mReverseMap.end()) {
+ ALOGE("cannot remove a non-exist sensor");
+ return;
+ }
+ int handle = i->second;
+ mReverseMap.erase(i);
+ mMap.erase(handle);
+
+ // will not clean up mPendingReport here, it will be cleaned up when at first activate call.
+ // sensorservice is guranteed to call activate upon arrival of dynamic sensor meta connection
+ // event.
+
+ // send disconnection event
+ sensors_event_t event;
+ ConnectionReport::fillDisconnectionEvent(&event, mHandleRange.first, handle);
+ submitEvent(nullptr, event);
+}
+
+int DynamicSensorManager::submitEvent(sp<BaseSensorObject> source, const sensors_event_t &e) {
+ int handle;
+ if (source == nullptr) {
+ handle = mHandleRange.first;
+ } else {
+ std::lock_guard<std::mutex> lk(mLock);
+ auto i = mReverseMap.find(source.get());
+ if (i == mReverseMap.end()) {
+ ALOGE("cannot submit event for sensor that has not been registered");
+ return NAME_NOT_FOUND;
+ }
+ handle = i->second;
+ }
+
+ // making a copy of events, prepare for editing
+ sensors_event_t event = e;
+ event.version = sizeof(event);
+
+ // special case of flush complete
+ if (event.type == SENSOR_TYPE_META_DATA) {
+ event.sensor = 0;
+ event.meta_data.sensor = handle;
+ } else {
+ event.sensor = handle;
+ }
+
+ // set timestamp if it is default value
+ if (event.timestamp == TIMESTAMP_AUTO_FILL) {
+ event.timestamp = elapsedRealtimeNano();
+ }
+
+ if (mCallback) {
+ // extention mode, calling callback directly
+ int ret;
+
+ ret = mCallback->submitEvent(nullptr, event);
+ if (ret < 0) {
+ ALOGE("DynamicSensorManager callback failed, ret: %d", ret);
+ }
+ } else {
+ // standalone mode, add event to internal buffer for poll() to pick up
+ std::lock_guard<std::mutex> lk(mFifoLock);
+ if (mFifo.write(&event, 1) < 0) {
+ ALOGE("DynamicSensorManager fifo full");
+ }
+ }
+ return 0;
+}
+
+int DynamicSensorManager::getNextAvailableHandle() {
+ if (mNextHandle == mHandleRange.second) {
+ return -1;
+ }
+ return mNextHandle++;
+}
+
+const sensor_t& DynamicSensorManager::getDynamicMetaSensor() const {
+ return mMetaSensor;
+}
+
+DynamicSensorManager::ConnectionReport::ConnectionReport(
+ int handle, sp<BaseSensorObject> sensor) :
+ mSensor(*(sensor->getSensor())),
+ mName(mSensor.name),
+ mVendor(mSensor.vendor),
+ mPermission(mSensor.requiredPermission),
+ mStringType(mSensor.stringType),
+ mGenerated(false) {
+ mSensor.name = mName.c_str();
+ mSensor.vendor = mVendor.c_str();
+ mSensor.requiredPermission = mPermission.c_str();
+ mSensor.stringType = mStringType.c_str();
+ mSensor.handle = handle;
+ memset(&mEvent, 0, sizeof(mEvent));
+ mEvent.version = sizeof(mEvent);
+ sensor->getUuid(mUuid);
+ ALOGV("Connection report init: name = %s, handle = %d", mSensor.name, mSensor.handle);
+}
+
+DynamicSensorManager::ConnectionReport::~ConnectionReport() {
+ ALOGV("Connection report dtor: name = %s, handle = %d", mSensor.name, mSensor.handle);
+}
+
+const sensors_event_t& DynamicSensorManager::ConnectionReport::
+ generateConnectionEvent(int metaHandle) {
+ if (!mGenerated) {
+ mEvent.sensor = metaHandle;
+ mEvent.type = SENSOR_TYPE_DYNAMIC_SENSOR_META;
+ mEvent.timestamp = elapsedRealtimeNano();
+ mEvent.dynamic_sensor_meta =
+ (dynamic_sensor_meta_event_t) {true, mSensor.handle, &mSensor, {0}};
+ memcpy(&mEvent.dynamic_sensor_meta.uuid, &mUuid, sizeof(mEvent.dynamic_sensor_meta.uuid));
+ mGenerated = true;
+ }
+ return mEvent;
+}
+
+void DynamicSensorManager::ConnectionReport::
+ fillDisconnectionEvent(sensors_event_t* event, int metaHandle, int handle) {
+ memset(event, 0, sizeof(sensors_event_t));
+ event->version = sizeof(sensors_event_t);
+ event->sensor = metaHandle;
+ event->type = SENSOR_TYPE_DYNAMIC_SENSOR_META;
+ event->timestamp = elapsedRealtimeNano();
+ event->dynamic_sensor_meta.connected = false;
+ event->dynamic_sensor_meta.handle = handle;
+}
+
+} // namespace SensorHalExt
+} // namespace android
diff --git a/modules/sensors/dynamic_sensor/DynamicSensorManager.h b/modules/sensors/dynamic_sensor/DynamicSensorManager.h
new file mode 100644
index 0000000..b8fd472
--- /dev/null
+++ b/modules/sensors/dynamic_sensor/DynamicSensorManager.h
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_SENSORHAL_EXT_DYNAMIC_SENSOR_MANAGER_H
+#define ANDROID_SENSORHAL_EXT_DYNAMIC_SENSOR_MANAGER_H
+
+#include "SensorEventCallback.h"
+#include "RingBuffer.h"
+#include <hardware/sensors.h>
+#include <utils/RefBase.h>
+
+#include <mutex>
+#include <string>
+#include <unordered_map>
+#include <vector>
+
+namespace android {
+namespace SensorHalExt {
+
+class BaseDynamicSensorDaemon;
+
+class DynamicSensorManager : public SensorEventCallback {
+public:
+ // handleBase is reserved for the dynamic sensor meta sensor.
+ // handleMax must be greater than handleBase + 1.
+ // This class has two operation mode depending on callback: 1) extension, 2) stand-alone.
+ // In extension mode, callback must not be nullptr. Sensor event generated will be submitted to
+ // buffer of primary sensor HAL implementation. In stand-alone mode, callback must be nullptr.
+ // Generated sensor events will be added into internal buffer waiting for poll() function to
+ // pick up.
+ //
+ static DynamicSensorManager* createInstance(
+ int handleBase, int handleCount, SensorEventCallback *callback);
+ virtual ~DynamicSensorManager();
+
+ // calls to add or remove sensor, called from sensor daemon
+ bool registerSensor(sp<BaseSensorObject> sensor);
+ void unregisterSensor(sp<BaseSensorObject> sensor);
+
+ // Determine if a sensor handle is in the range defined in constructor.
+ // It does not test if sensor handle is valid.
+ bool owns(int handle) const;
+
+ // handles sensor hal requests.
+ int activate(int handle, bool enable);
+ int batch(int handle, nsecs_t sample_period, nsecs_t batch_period);
+ int setDelay(int handle, nsecs_t sample_period);
+ int flush(int handle);
+ int poll(sensors_event_t * data, int count);
+
+ // SensorEventCallback
+ virtual int submitEvent(sp<BaseSensorObject>, const sensors_event_t &e) override;
+
+ // get meta sensor struct
+ const sensor_t& getDynamicMetaSensor() const;
+protected:
+ DynamicSensorManager(int handleBase, int handleMax, SensorEventCallback* callback);
+private:
+ // a helper class used for generate connection and disconnection report
+ class ConnectionReport {
+ public:
+ ConnectionReport() {}
+ ConnectionReport(int handle, sp<BaseSensorObject> sensor);
+ ~ConnectionReport();
+ const sensors_event_t& generateConnectionEvent(int metaHandle);
+ static void fillDisconnectionEvent(sensors_event_t* event, int metaHandle, int handle);
+ private:
+ sensor_t mSensor;
+ std::string mName;
+ std::string mVendor;
+ std::string mPermission;
+ std::string mStringType;
+ sensors_event_t mEvent;
+ uint8_t mUuid[16];
+ bool mGenerated;
+ DISALLOW_EVIL_CONSTRUCTORS(ConnectionReport);
+ };
+
+ // returns next available handle to use upon a new sensor connection, or -1 if we run out.
+ int getNextAvailableHandle();
+
+ // TF: int foo(sp<BaseSensorObject> obj);
+ template <typename TF>
+ int operateSensor(int handle, TF f) const {
+ std::lock_guard<std::mutex> lk(mLock);
+ const auto i = mMap.find(handle);
+ if (i == mMap.end()) {
+ return BAD_VALUE;
+ }
+ sp<BaseSensorObject> s = i->second.promote();
+ if (s == nullptr) {
+ // sensor object is already gone
+ return BAD_VALUE;
+ }
+ return f(s);
+ }
+
+ // available sensor handle space
+ const std::pair<int, int> mHandleRange;
+ sensor_t mMetaSensor;
+
+ // immutable pointer to event callback, used in extention mode.
+ SensorEventCallback * const mCallback;
+
+ // RingBuffer used in standalone mode
+ static constexpr size_t kFifoSize = 4096; //4K events
+ mutable std::mutex mFifoLock;
+ RingBuffer mFifo;
+
+ // mapping between handle and SensorObjects
+ mutable std::mutex mLock;
+ int mNextHandle;
+ std::unordered_map<int, wp<BaseSensorObject> > mMap;
+ std::unordered_map<void *, int> mReverseMap;
+ mutable std::unordered_map<int, ConnectionReport> mPendingReport;
+
+ // daemons
+ std::vector<sp<BaseDynamicSensorDaemon>> mDaemonVector;
+};
+
+} // namespace SensorHalExt
+} // namespace android
+
+#endif // ANDROID_SENSORHAL_EXT_DYNAMIC_SENSOR_MANAGER_H
diff --git a/modules/sensors/dynamic_sensor/RingBuffer.cpp b/modules/sensors/dynamic_sensor/RingBuffer.cpp
new file mode 100644
index 0000000..5857a7c
--- /dev/null
+++ b/modules/sensors/dynamic_sensor/RingBuffer.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "RingBuffer.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+namespace android {
+
+RingBuffer::RingBuffer(size_t size)
+ : mSize(size),
+ mData((sensors_event_t *)malloc(sizeof(sensors_event_t) * mSize)),
+ mReadPos(0),
+ mWritePos(0) {
+}
+
+RingBuffer::~RingBuffer() {
+ free(mData);
+ mData = NULL;
+}
+
+ssize_t RingBuffer::write(const sensors_event_t *ev, size_t size) {
+ Mutex::Autolock autoLock(mLock);
+
+ size_t numAvailableToRead = mWritePos - mReadPos;
+ size_t numAvailableToWrite = mSize - numAvailableToRead;
+
+ if (size > numAvailableToWrite) {
+ size = numAvailableToWrite;
+ }
+
+ size_t writePos = (mWritePos % mSize);
+ size_t copy = mSize - writePos;
+
+ if (copy > size) {
+ copy = size;
+ }
+
+ memcpy(&mData[writePos], ev, copy * sizeof(sensors_event_t));
+
+ if (size > copy) {
+ memcpy(mData, &ev[copy], (size - copy) * sizeof(sensors_event_t));
+ }
+
+ mWritePos += size;
+
+ if (numAvailableToRead == 0 && size > 0) {
+ mNotEmptyCondition.broadcast();
+ }
+
+ return size;
+}
+
+ssize_t RingBuffer::read(sensors_event_t *ev, size_t size) {
+ Mutex::Autolock autoLock(mLock);
+
+ size_t numAvailableToRead;
+ for (;;) {
+ numAvailableToRead = mWritePos - mReadPos;
+ if (numAvailableToRead > 0) {
+ break;
+ }
+
+ mNotEmptyCondition.wait(mLock);
+ }
+
+ if (size > numAvailableToRead) {
+ size = numAvailableToRead;
+ }
+
+ size_t readPos = (mReadPos % mSize);
+ size_t copy = mSize - readPos;
+
+ if (copy > size) {
+ copy = size;
+ }
+
+ memcpy(ev, &mData[readPos], copy * sizeof(sensors_event_t));
+
+ if (size > copy) {
+ memcpy(&ev[copy], mData, (size - copy) * sizeof(sensors_event_t));
+ }
+
+ mReadPos += size;
+
+ return size;
+}
+
+} // namespace android
+
diff --git a/modules/sensors/dynamic_sensor/RingBuffer.h b/modules/sensors/dynamic_sensor/RingBuffer.h
new file mode 100644
index 0000000..aa6b8c9
--- /dev/null
+++ b/modules/sensors/dynamic_sensor/RingBuffer.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RING_BUFFER_H_
+
+#define RING_BUFFER_H_
+
+#include <media/stagefright/foundation/ABase.h>
+
+#include <hardware/sensors.h>
+#include <utils/threads.h>
+
+namespace android {
+
+class RingBuffer {
+public:
+ explicit RingBuffer(size_t size);
+ ~RingBuffer();
+
+ ssize_t write(const sensors_event_t *ev, size_t size);
+ ssize_t read(sensors_event_t *ev, size_t size);
+
+private:
+ Mutex mLock;
+ Condition mNotEmptyCondition;
+
+ size_t mSize;
+ sensors_event_t *mData;
+ size_t mReadPos, mWritePos;
+
+ DISALLOW_EVIL_CONSTRUCTORS(RingBuffer);
+};
+
+} // namespace android
+
+#endif // RING_BUFFER_H_
diff --git a/modules/sensors/dynamic_sensor/SensorEventCallback.h b/modules/sensors/dynamic_sensor/SensorEventCallback.h
new file mode 100644
index 0000000..b98cd7f
--- /dev/null
+++ b/modules/sensors/dynamic_sensor/SensorEventCallback.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_SENSORHAL_DSE_SENSOR_EVENT_CALLBACK_H
+#define ANDROID_SENSORHAL_DSE_SENSOR_EVENT_CALLBACK_H
+
+#include <hardware/sensors.h>
+#include <utils/RefBase.h>
+
+namespace android {
+namespace SensorHalExt {
+
+class BaseSensorObject;
+
+// if timestamp in sensors_event_t has this value, it will be filled at dispatcher.
+constexpr int64_t TIMESTAMP_AUTO_FILL = -1;
+
+class SensorEventCallback {
+public:
+ virtual int submitEvent(sp<BaseSensorObject> sensor, const sensors_event_t &e) = 0;
+ virtual ~SensorEventCallback() = default;
+};
+
+} // namespace SensorHalExt
+} // namespace android
+
+#endif // ANDROID_SENSORHAL_DSE_SENSOR_EVENT_CALLBACK_H
diff --git a/modules/sensors/dynamic_sensor/sensors.cpp b/modules/sensors/dynamic_sensor/sensors.cpp
new file mode 100644
index 0000000..7c203b2
--- /dev/null
+++ b/modules/sensors/dynamic_sensor/sensors.cpp
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "DynamicSensorManager.h"
+#include "sensors.h"
+
+#include <cutils/properties.h>
+#include <media/stagefright/foundation/ADebug.h>
+#include <utils/Log.h>
+
+#include <errno.h>
+#include <string.h>
+using namespace android;
+
+////////////////////////////////////////////////////////////////////////////////
+
+SensorContext::SensorContext(const struct hw_module_t *module) {
+ memset(&device, 0, sizeof(device));
+
+ device.common.tag = HARDWARE_DEVICE_TAG;
+ device.common.version = SENSORS_DEVICE_API_VERSION_1_3;
+ device.common.module = const_cast<hw_module_t *>(module);
+ device.common.close = CloseWrapper;
+ device.activate = ActivateWrapper;
+ device.setDelay = SetDelayWrapper;
+ device.poll = PollWrapper;
+ device.batch = BatchWrapper;
+ device.flush = FlushWrapper;
+
+ // initialize dynamic sensor manager
+ int32_t base = property_get_int32("sensor.dynamic_sensor_hal.handle_base", kDynamicHandleBase);
+ int32_t count =
+ property_get_int32("sensor.dynamic_sensor_hal.handle_count", kMaxDynamicHandleCount);
+ mDynamicSensorManager.reset(DynamicSensorManager::createInstance(base, count, nullptr));
+}
+
+int SensorContext::close() {
+ delete this;
+ return 0;
+}
+
+int SensorContext::activate(int handle, int enabled) {
+ return mDynamicSensorManager->activate(handle, enabled);
+}
+
+int SensorContext::setDelay(int handle, int64_t delayNs) {
+ return mDynamicSensorManager->setDelay(handle, delayNs);
+}
+
+int SensorContext::poll(sensors_event_t *data, int count) {
+ return mDynamicSensorManager->poll(data, count);
+}
+
+int SensorContext::batch(
+ int handle,
+ int64_t sampling_period_ns,
+ int64_t max_report_latency_ns) {
+ return mDynamicSensorManager->batch(handle, sampling_period_ns, max_report_latency_ns);
+}
+
+int SensorContext::flush(int handle) {
+ return mDynamicSensorManager->flush(handle);
+}
+
+// static
+int SensorContext::CloseWrapper(struct hw_device_t *dev) {
+ return reinterpret_cast<SensorContext *>(dev)->close();
+}
+
+// static
+int SensorContext::ActivateWrapper(
+ struct sensors_poll_device_t *dev, int handle, int enabled) {
+ return reinterpret_cast<SensorContext *>(dev)->activate(handle, enabled);
+}
+
+// static
+int SensorContext::SetDelayWrapper(
+ struct sensors_poll_device_t *dev, int handle, int64_t delayNs) {
+ return reinterpret_cast<SensorContext *>(dev)->setDelay(handle, delayNs);
+}
+
+// static
+int SensorContext::PollWrapper(
+ struct sensors_poll_device_t *dev, sensors_event_t *data, int count) {
+ return reinterpret_cast<SensorContext *>(dev)->poll(data, count);
+}
+
+// static
+int SensorContext::BatchWrapper(
+ struct sensors_poll_device_1 *dev,
+ int handle,
+ int flags,
+ int64_t sampling_period_ns,
+ int64_t max_report_latency_ns) {
+ (void) flags;
+ return reinterpret_cast<SensorContext *>(dev)->batch(
+ handle, sampling_period_ns, max_report_latency_ns);
+}
+
+// static
+int SensorContext::FlushWrapper(struct sensors_poll_device_1 *dev, int handle) {
+ return reinterpret_cast<SensorContext *>(dev)->flush(handle);
+}
+
+size_t SensorContext::getSensorList(sensor_t const **list) {
+ *list = &(mDynamicSensorManager->getDynamicMetaSensor());
+ return 1;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+static sensor_t const *sensor_list;
+
+static int open_sensors(
+ const struct hw_module_t *module,
+ const char *,
+ struct hw_device_t **dev) {
+ SensorContext *ctx = new SensorContext(module);
+ ctx->getSensorList(&sensor_list);
+ *dev = &ctx->device.common;
+ return 0;
+}
+
+static struct hw_module_methods_t sensors_module_methods = {
+ .open = open_sensors
+};
+
+static int get_sensors_list(
+ struct sensors_module_t *,
+ struct sensor_t const **list) {
+ *list = sensor_list;
+ return 1;
+}
+
+static int set_operation_mode(unsigned int mode) {
+ return (mode) ? -EINVAL : 0;
+}
+
+struct sensors_module_t HAL_MODULE_INFO_SYM = {
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .version_major = 1,
+ .version_minor = 0,
+ .id = SENSORS_HARDWARE_MODULE_ID,
+ .name = "Google Dynamic Sensor Manager",
+ .author = "Google",
+ .methods = &sensors_module_methods,
+ .dso = NULL,
+ .reserved = {0},
+ },
+ .get_sensors_list = get_sensors_list,
+ .set_operation_mode = set_operation_mode,
+};
diff --git a/modules/sensors/dynamic_sensor/sensors.h b/modules/sensors/dynamic_sensor/sensors.h
new file mode 100644
index 0000000..be42b67
--- /dev/null
+++ b/modules/sensors/dynamic_sensor/sensors.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SENSORS_H_
+#define SENSORS_H_
+
+#include <hardware/hardware.h>
+#include <hardware/sensors.h>
+#include <media/stagefright/foundation/ABase.h>
+#include <utils/RefBase.h>
+
+#include <memory>
+#include <unordered_set>
+#include <vector>
+
+namespace android {
+ namespace SensorHalExt {
+ class DynamicSensorManager;
+ } // namespace BaseSensorObject
+} // namespace android
+
+using android::SensorHalExt::DynamicSensorManager;
+
+class SensorContext {
+public:
+ struct sensors_poll_device_1 device;
+
+ explicit SensorContext(const struct hw_module_t *module);
+
+ size_t getSensorList(sensor_t const **list);
+
+private:
+
+ int close();
+ int activate(int handle, int enabled);
+ int setDelay(int handle, int64_t delayNs);
+ int poll(sensors_event_t *data, int count);
+
+ int batch(int handle, int64_t sampling_period_ns,
+ int64_t max_report_latency_ns);
+
+ int flush(int handle);
+
+ // static wrappers
+ static int CloseWrapper(struct hw_device_t *dev);
+
+ static int ActivateWrapper(
+ struct sensors_poll_device_t *dev, int handle, int enabled);
+
+ static int SetDelayWrapper(
+ struct sensors_poll_device_t *dev, int handle, int64_t delayNs);
+
+ static int PollWrapper(
+ struct sensors_poll_device_t *dev, sensors_event_t *data, int count);
+
+ static int BatchWrapper(
+ struct sensors_poll_device_1 *dev,
+ int handle,
+ int flags,
+ int64_t sampling_period_ns,
+ int64_t max_report_latency_ns);
+
+ static int FlushWrapper(struct sensors_poll_device_1 *dev, int handle);
+
+ // default ~16 million handles for dynamic sensor use, can be overriden by system property
+ static constexpr int32_t kDynamicHandleBase = 0x10000;
+ static constexpr int32_t kDynamicHandleEnd = 0x1000000;
+ static constexpr int32_t kMaxDynamicHandleCount = kDynamicHandleEnd - kDynamicHandleBase;
+
+ std::unique_ptr<DynamicSensorManager> mDynamicSensorManager;
+
+ DISALLOW_EVIL_CONSTRUCTORS(SensorContext);
+};
+
+#endif // SENSORS_H_
diff --git a/modules/sensors/multihal.cpp b/modules/sensors/multihal.cpp
index f38d90d..2810118 100644
--- a/modules/sensors/multihal.cpp
+++ b/modules/sensors/multihal.cpp
@@ -14,33 +14,30 @@
* limitations under the License.
*/
-#include <hardware/sensors.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <dirent.h>
-#include <math.h>
-#include <poll.h>
-#include <pthread.h>
-#include <cutils/atomic.h>
+#include "SensorEventQueue.h"
+#include "multihal.h"
#define LOG_NDEBUG 1
#include <cutils/log.h>
+#include <cutils/atomic.h>
+#include <hardware/sensors.h>
#include <vector>
#include <string>
#include <fstream>
#include <map>
-#include <string>
-#include <stdio.h>
+#include <dirent.h>
#include <dlfcn.h>
-#include <SensorEventQueue.h>
-
+#include <errno.h>
+#include <fcntl.h>
#include <limits.h>
+#include <math.h>
+#include <poll.h>
+#include <pthread.h>
+#include <stdio.h>
#include <stdlib.h>
-static const char* CONFIG_FILENAME = "/system/etc/sensors/hals.conf";
-static const int MAX_CONF_LINE_LENGTH = 1024;
static pthread_mutex_t init_modules_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t init_sensors_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -258,9 +255,9 @@
}
}
-// Android L requires sensor HALs to be either 1_0 or 1_3 compliant
+// Android N and hire require sensor HALs to be at least 1_3 compliant
#define HAL_VERSION_IS_COMPLIANT(version) \
- (version == SENSORS_DEVICE_API_VERSION_1_0 || version >= SENSORS_DEVICE_API_VERSION_1_3)
+ (version >= SENSORS_DEVICE_API_VERSION_1_3)
// Returns true if HAL is compliant, false if HAL is not compliant or if handle is invalid
static bool halIsCompliant(sensors_poll_context_t *ctx, int handle) {
@@ -504,13 +501,13 @@
*/
static void get_so_paths(std::vector<std::string> *so_paths) {
std::string line;
- std::ifstream conf_file(CONFIG_FILENAME);
+ std::ifstream conf_file(MULTI_HAL_CONFIG_FILE_PATH);
if(!conf_file) {
- ALOGW("No multihal config file found at %s", CONFIG_FILENAME);
+ ALOGW("No multihal config file found at %s", MULTI_HAL_CONFIG_FILE_PATH);
return;
}
- ALOGV("Multihal config file found at %s", CONFIG_FILENAME);
+ ALOGV("Multihal config file found at %s", MULTI_HAL_CONFIG_FILE_PATH);
while (std::getline(conf_file, line)) {
ALOGV("config file line: '%s'", line.c_str());
so_paths->push_back(line);
@@ -660,6 +657,10 @@
.get_sensors_list = module__get_sensors_list
};
+struct sensors_module_t *get_multi_hal_module_info() {
+ return (&HAL_MODULE_INFO_SYM);
+}
+
static int open_sensors(const struct hw_module_t* hw_module, const char* name,
struct hw_device_t** hw_device_out) {
ALOGV("open_sensors begin...");
diff --git a/modules/sensors/multihal.h b/modules/sensors/multihal.h
new file mode 100644
index 0000000..210c7cc
--- /dev/null
+++ b/modules/sensors/multihal.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef HARDWARE_LIBHARDWARE_MODULES_SENSORS_MULTIHAL_H_
+#define HARDWARE_LIBHARDWARE_MODULES_SENSORS_MULTIHAL_H_
+
+#include <hardware/sensors.h>
+#include <hardware/hardware.h>
+
+static const char* MULTI_HAL_CONFIG_FILE_PATH = "/system/etc/sensors/hals.conf";
+
+struct sensors_module_t *get_multi_hal_module_info(void);
+
+#endif // HARDWARE_LIBHARDWARE_MODULES_SENSORS_MULTIHAL_H_
diff --git a/modules/sensors/tests/SensorEventQueue_test.cpp b/modules/sensors/tests/SensorEventQueue_test.cpp
index 3218bb9..d3d75ee 100644
--- a/modules/sensors/tests/SensorEventQueue_test.cpp
+++ b/modules/sensors/tests/SensorEventQueue_test.cpp
@@ -32,7 +32,7 @@
return true;
}
-bool checkInt(char* msg, int expected, int actual) {
+bool checkInt(const char* msg, int expected, int actual) {
if (actual != expected) {
printf("%s; expected %d; actual was %d\n", msg, expected, actual);
return false;
@@ -187,7 +187,7 @@
}
-int main(int argc, char **argv) {
+int main(int argc __attribute((unused)), char **argv __attribute((unused))) {
if (testSimpleWriteSizeCounts() &&
testWrappingWriteSizeCounts() &&
testFullQueueIo()) {
diff --git a/modules/soundtrigger/Android.mk b/modules/soundtrigger/Android.mk
index bb58053..8250f9b 100644
--- a/modules/soundtrigger/Android.mk
+++ b/modules/soundtrigger/Android.mk
@@ -19,6 +19,7 @@
LOCAL_MODULE := sound_trigger.stub.default
LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_PROPRIETARY_MODULE := true
LOCAL_SRC_FILES := sound_trigger_hw.c
LOCAL_SHARED_LIBRARIES := liblog libcutils
LOCAL_MODULE_TAGS := optional
diff --git a/modules/thermal/Android.mk b/modules/thermal/Android.mk
index 80ad78a..ff51145 100644
--- a/modules/thermal/Android.mk
+++ b/modules/thermal/Android.mk
@@ -18,6 +18,7 @@
LOCAL_MODULE := thermal.default
LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_PROPRIETARY_MODULE := true
LOCAL_SRC_FILES := thermal.c
LOCAL_SHARED_LIBRARIES := liblog libcutils
LOCAL_MODULE_TAGS := optional
diff --git a/modules/tv_input/Android.bp b/modules/tv_input/Android.bp
index beac132..509198d 100644
--- a/modules/tv_input/Android.bp
+++ b/modules/tv_input/Android.bp
@@ -15,6 +15,7 @@
cc_library_shared {
name: "tv_input.default",
relative_install_path: "hw",
+ proprietary: true,
shared_libs: [
"libcutils",
"liblog",
diff --git a/modules/tv_input/tv_input.cpp b/modules/tv_input/tv_input.cpp
index 114e80e..ddace28 100644
--- a/modules/tv_input/tv_input.cpp
+++ b/modules/tv_input/tv_input.cpp
@@ -37,18 +37,18 @@
const char* name, struct hw_device_t** device);
static struct hw_module_methods_t tv_input_module_methods = {
- open: tv_input_device_open
+ .open = tv_input_device_open
};
tv_input_module_t HAL_MODULE_INFO_SYM = {
- common: {
- tag: HARDWARE_MODULE_TAG,
- version_major: 0,
- version_minor: 1,
- id: TV_INPUT_HARDWARE_MODULE_ID,
- name: "Sample TV input module",
- author: "The Android Open Source Project",
- methods: &tv_input_module_methods,
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .version_major = 0,
+ .version_minor = 1,
+ .id = TV_INPUT_HARDWARE_MODULE_ID,
+ .name = "Sample TV input module",
+ .author = "The Android Open Source Project",
+ .methods = &tv_input_module_methods,
}
};
diff --git a/modules/usbaudio/Android.mk b/modules/usbaudio/Android.mk
index 9df1e79..b36bf9f 100644
--- a/modules/usbaudio/Android.mk
+++ b/modules/usbaudio/Android.mk
@@ -18,6 +18,7 @@
LOCAL_MODULE := audio.usb.default
LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_PROPRIETARY_MODULE := true
LOCAL_SRC_FILES := \
audio_hal.c
LOCAL_C_INCLUDES += \
diff --git a/modules/usbcamera/Camera.cpp b/modules/usbcamera/Camera.cpp
index cf62f7f..b396291 100644
--- a/modules/usbcamera/Camera.cpp
+++ b/modules/usbcamera/Camera.cpp
@@ -484,9 +484,9 @@
// TODO: dump all settings
dprintf(fd, "Most Recent Settings: (%p)\n", mSettings);
- dprintf(fd, "Number of streams: %d\n", mStreams.size());
+ dprintf(fd, "Number of streams: %zu\n", mStreams.size());
for (size_t i = 0; i < mStreams.size(); i++) {
- dprintf(fd, "Stream %d/%d:\n", i, mStreams.size());
+ dprintf(fd, "Stream %zu/%zu:\n", i, mStreams.size());
mStreams[i]->dump(fd);
}
}
diff --git a/modules/usbcamera/CameraHAL.cpp b/modules/usbcamera/CameraHAL.cpp
index 652e937..c54283b 100644
--- a/modules/usbcamera/CameraHAL.cpp
+++ b/modules/usbcamera/CameraHAL.cpp
@@ -65,7 +65,7 @@
int CameraHAL::getNumberOfCameras() {
android::Mutex::Autolock al(mModuleLock);
- ALOGV("%s: %d", __func__, mCameras.size());
+ ALOGV("%s: %zu", __func__, mCameras.size());
return static_cast<int>(mCameras.size());
}
@@ -126,29 +126,29 @@
}
static hw_module_methods_t gCameraModuleMethods = {
- open : open_dev
+ .open = open_dev
};
camera_module_t HAL_MODULE_INFO_SYM __attribute__ ((visibility("default"))) = {
- common : {
- tag : HARDWARE_MODULE_TAG,
- module_api_version : CAMERA_MODULE_API_VERSION_2_4,
- hal_api_version : HARDWARE_HAL_API_VERSION,
- id : CAMERA_HARDWARE_MODULE_ID,
- name : "Default USB Camera HAL",
- author : "The Android Open Source Project",
- methods : &gCameraModuleMethods,
- dso : NULL,
- reserved : {0},
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .module_api_version = CAMERA_MODULE_API_VERSION_2_4,
+ .hal_api_version = HARDWARE_HAL_API_VERSION,
+ .id = CAMERA_HARDWARE_MODULE_ID,
+ .name = "Default USB Camera HAL",
+ .author = "The Android Open Source Project",
+ .methods = &gCameraModuleMethods,
+ .dso = NULL,
+ .reserved = {0},
},
- get_number_of_cameras : get_number_of_cameras,
- get_camera_info : get_camera_info,
- set_callbacks : set_callbacks,
- get_vendor_tag_ops : NULL,
- open_legacy : NULL,
- set_torch_mode : NULL,
- init : NULL,
- reserved : {0},
+ .get_number_of_cameras = get_number_of_cameras,
+ .get_camera_info = get_camera_info,
+ .set_callbacks = set_callbacks,
+ .get_vendor_tag_ops = NULL,
+ .open_legacy = NULL,
+ .set_torch_mode = NULL,
+ .init = NULL,
+ .reserved = {0},
};
} // extern "C"
diff --git a/modules/usbcamera/HotplugThread.cpp b/modules/usbcamera/HotplugThread.cpp
index 6c65086..02e7167 100644
--- a/modules/usbcamera/HotplugThread.cpp
+++ b/modules/usbcamera/HotplugThread.cpp
@@ -39,6 +39,7 @@
}
bool HotplugThread::threadLoop() {
+ (void)mModule; // silence warning about unused member.
/**
* Check camera connection status change, if connected, do below:
diff --git a/modules/usbcamera/Stream.cpp b/modules/usbcamera/Stream.cpp
index f56866e..2b83421 100644
--- a/modules/usbcamera/Stream.cpp
+++ b/modules/usbcamera/Stream.cpp
@@ -170,10 +170,9 @@
// ToDo: prettyprint usage mask flags
dprintf(fd, "Gralloc Usage Mask: %#" PRIx32 "\n", mStream->usage);
dprintf(fd, "Max Buffer Count: %" PRIu32 "\n", mStream->max_buffers);
- dprintf(fd, "Number of Buffers in use by HAL: %" PRIu32 "\n", mBuffers.size());
+ dprintf(fd, "Number of Buffers in use by HAL: %zu\n", mBuffers.size());
for (size_t i = 0; i < mBuffers.size(); i++) {
- dprintf(fd, "Buffer %" PRIu32 "/%" PRIu32 ": %p\n", i, mBuffers.size(),
- mBuffers[i]);
+ dprintf(fd, "Buffer %zu/%zu: %p\n", i, mBuffers.size(), mBuffers[i]);
}
}
diff --git a/modules/usbcamera/UsbCamera.cpp b/modules/usbcamera/UsbCamera.cpp
index d0aaded..9d53fc6 100644
--- a/modules/usbcamera/UsbCamera.cpp
+++ b/modules/usbcamera/UsbCamera.cpp
@@ -313,7 +313,7 @@
return setTemplate(CAMERA3_TEMPLATE_MANUAL, m.get());
}
-bool UsbCamera::isValidCaptureSettings(const camera_metadata_t* settings) {
+bool UsbCamera::isValidCaptureSettings(const camera_metadata_t* /*settings*/) {
// TODO: reject settings that cannot be captured
return true;
}
diff --git a/modules/vehicle/Android.mk b/modules/vehicle/Android.mk
index a666bc6..9fd49da 100644
--- a/modules/vehicle/Android.mk
+++ b/modules/vehicle/Android.mk
@@ -19,6 +19,7 @@
LOCAL_MODULE := vehicle.default
LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_PROPRIETARY_MODULE := true
LOCAL_C_INCLUDES := hardware/libhardware
LOCAL_SRC_FILES := vehicle.c timeUtil.cpp
LOCAL_SHARED_LIBRARIES := liblog libcutils libutils
diff --git a/modules/vehicle/vehicle.c b/modules/vehicle/vehicle.c
index a26f27c..2d945fd 100644
--- a/modules/vehicle/vehicle.c
+++ b/modules/vehicle/vehicle.c
@@ -279,10 +279,10 @@
ALOGD("Value type: FLOAT\nValue: %f\n", data->value.float_value);
break;
case VEHICLE_VALUE_TYPE_INT32:
- ALOGD("Value type: INT32\nValue: %d\n", data->value.int32_value);
+ ALOGD("Value type: INT32\nValue: %" PRId32 "\n", data->value.int32_value);
break;
case VEHICLE_VALUE_TYPE_INT64:
- ALOGD("Value type: INT64\nValue: %lld\n", data->value.int64_value);
+ ALOGD("Value type: INT64\nValue: %" PRId64 "\n", data->value.int64_value);
break;
case VEHICLE_VALUE_TYPE_BOOLEAN:
ALOGD("Value type: BOOLEAN\nValue: %d\n", data->value.boolean_value);
@@ -331,22 +331,6 @@
event.prop = sub->prop;
event.timestamp = elapsedRealtimeNano();
switch (sub->prop) {
- case VEHICLE_PROPERTY_DRIVING_STATUS:
- event.value_type = VEHICLE_VALUE_TYPE_INT32;
- switch ((event.timestamp & 0x30000000)>>28) {
- case 0:
- event.value.driving_status = VEHICLE_DRIVING_STATUS_UNRESTRICTED;
- break;
- case 1:
- event.value.driving_status = VEHICLE_DRIVING_STATUS_NO_VIDEO;
- break;
- case 2:
- event.value.driving_status = VEHICLE_DRIVING_STATUS_NO_KEYBOARD_INPUT;
- break;
- default:
- event.value.driving_status = VEHICLE_DRIVING_STATUS_NO_CONFIG;
- }
- break;
case VEHICLE_PROPERTY_GEAR_SELECTION:
event.value_type = VEHICLE_VALUE_TYPE_INT32;
switch ((event.timestamp & 0x30000000)>>28) {
diff --git a/modules/vibrator/Android.bp b/modules/vibrator/Android.bp
index f9afd45..3c4aebf 100644
--- a/modules/vibrator/Android.bp
+++ b/modules/vibrator/Android.bp
@@ -18,6 +18,7 @@
// HAL module implementation stored in
// hw/<VIBRATOR_HARDWARE_MODULE_ID>.default.so
relative_install_path: "hw",
+ proprietary: true,
include_dirs: ["hardware/libhardware"],
srcs: ["vibrator.c"],
shared_libs: ["liblog"],
diff --git a/modules/vr/Android.mk b/modules/vr/Android.mk
index 43c8e92..e04c0da 100644
--- a/modules/vr/Android.mk
+++ b/modules/vr/Android.mk
@@ -18,6 +18,7 @@
LOCAL_MODULE := vr.default
LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_PROPRIETARY_MODULE := true
LOCAL_SRC_FILES := vr.c
LOCAL_SHARED_LIBRARIES := libcutils
LOCAL_MODULE_TAGS := optional
diff --git a/tests/camera2/Android.mk b/tests/camera2/Android.mk
index e45f467..d77c18d 100644
--- a/tests/camera2/Android.mk
+++ b/tests/camera2/Android.mk
@@ -25,7 +25,8 @@
libgui \
libsync \
libui \
- libdl
+ libdl \
+ android.hardware.camera.device@3.2
LOCAL_C_INCLUDES += \
system/media/camera/include \
diff --git a/tests/camera2/CameraModuleFixture.h b/tests/camera2/CameraModuleFixture.h
index 25513af..b0d49e2 100644
--- a/tests/camera2/CameraModuleFixture.h
+++ b/tests/camera2/CameraModuleFixture.h
@@ -74,7 +74,6 @@
void TearDown() {
TEST_EXTENSION_FORKING_TEAR_DOWN;
- delete mModule;
TearDownMixin();
/* important: device must be destructed before closing module,
@@ -85,6 +84,7 @@
ASSERT_EQ(0, HWModuleHelpers::closeModule(mModule->getDso()))
<< "Failed to close camera HAL module";
}
+ delete mModule;
}
void CreateCamera(int cameraID, /*out*/ sp<CameraDeviceBase> *device) {
@@ -98,7 +98,7 @@
case CAMERA_DEVICE_API_VERSION_3_0:
case CAMERA_DEVICE_API_VERSION_3_1:
case CAMERA_DEVICE_API_VERSION_3_2:
- *device = new Camera3Device(cameraID);
+ *device = new Camera3Device(String8::format("%d", cameraID));
break;
default:
device->clear();
diff --git a/tests/hardware/Android.bp b/tests/hardware/Android.bp
deleted file mode 100644
index 668e28f..0000000
--- a/tests/hardware/Android.bp
+++ /dev/null
@@ -1,15 +0,0 @@
-cc_library_static {
- name: "static-hal-check",
- srcs: [
- "struct-size.cpp",
- "struct-offset.cpp",
- "struct-last.cpp",
- ],
- shared_libs: ["libhardware"],
- cflags: [
- "-std=gnu++11",
- "-O0",
- ],
-
- include_dirs: ["system/media/camera/include"],
-}
diff --git a/tests/hardware/Android.mk b/tests/hardware/Android.mk
new file mode 100644
index 0000000..02540c9
--- /dev/null
+++ b/tests/hardware/Android.mk
@@ -0,0 +1,12 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := static-hal-check
+LOCAL_SRC_FILES := struct-size.cpp struct-offset.cpp struct-last.cpp
+LOCAL_SHARED_LIBRARIES := libhardware
+LOCAL_CFLAGS := -std=gnu++11 -O0
+
+LOCAL_C_INCLUDES += \
+ system/media/camera/include
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/tests/hardware/struct-offset.cpp b/tests/hardware/struct-offset.cpp
index 10c0895..7f7f2e0 100644
--- a/tests/hardware/struct-offset.cpp
+++ b/tests/hardware/struct-offset.cpp
@@ -116,7 +116,9 @@
CHECK_MEMBER_AT(sensors_poll_device_1_t, batch, 76, 144);
CHECK_MEMBER_AT(sensors_poll_device_1_t, flush, 80, 152);
CHECK_MEMBER_AT(sensors_poll_device_1_t, inject_sensor_data, 84, 160);
- CHECK_MEMBER_AT(sensors_poll_device_1_t, reserved_procs, 88, 168);
+ CHECK_MEMBER_AT(sensors_poll_device_1_t, register_direct_channel, 88, 168);
+ CHECK_MEMBER_AT(sensors_poll_device_1_t, config_direct_report, 92, 176);
+ CHECK_MEMBER_AT(sensors_poll_device_1_t, reserved_procs, 96, 184);
//Types defined in fb.h
CHECK_MEMBER_AT(framebuffer_device_t, common, 0, 0);
diff --git a/tests/vehicle/README b/tests/vehicle/README
index b8fc7d4..42d2210 100644
--- a/tests/vehicle/README
+++ b/tests/vehicle/README
@@ -49,13 +49,13 @@
$ mmm hardware/libhardware
This will generate the following binaries that we care about:
-i) out/target/product/XXX/system/lib/hw/vehicle.default.so
+i) out/target/product/XXX/vendor/lib/hw/vehicle.default.so
ii) out/target/product/XXX/data/nativetest/vehicle_tests
iii) out/target/product/XXX/system/bin/vehicle-hal-tool
The location for the first shared library would be:
-$ adb push out/target/product/XXX/system/lib/hw/vehicle.default.so
-/system/lib/hw
+$ adb push out/target/product/XXX/vendor/lib/hw/vehicle.default.so
+/vendor/lib/hw
You can also use 'adb sync' if you like, although this is the easiest least
hassle way of putting it in place.
diff --git a/tests/vehicle/vehicle-hal-tool.c b/tests/vehicle/vehicle-hal-tool.c
old mode 100755
new mode 100644