Merge changes from topic 'merge_nyc_car'
* changes:
cherry-pick vehicle hal changes from nyc-car
Remove driver seats from vehicle.h
Fix seat temperature access mode
Cleanup vehicle.h
Add missing HVAC properties
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index 3b734f7..b49dce6 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -682,7 +682,7 @@
struct audio_hw_device** device)
{
return module->methods->open(module, AUDIO_HARDWARE_INTERFACE,
- (struct hw_device_t**)device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int audio_hw_device_close(struct audio_hw_device* device)
diff --git a/include/hardware/camera2.h b/include/hardware/camera2.h
index 2b7add0..547a1d7 100644
--- a/include/hardware/camera2.h
+++ b/include/hardware/camera2.h
@@ -146,7 +146,7 @@
typedef struct camera2_jpeg_blob {
uint16_t jpeg_blob_id;
uint32_t jpeg_size;
-};
+} camera2_jpeg_blob_t;
enum {
CAMERA2_JPEG_BLOB_ID = 0x00FF
diff --git a/include/hardware/fb.h b/include/hardware/fb.h
index 9df9416..65720a3 100644
--- a/include/hardware/fb.h
+++ b/include/hardware/fb.h
@@ -160,7 +160,7 @@
static inline int framebuffer_open(const struct hw_module_t* module,
struct framebuffer_device_t** device) {
return module->methods->open(module,
- GRALLOC_HARDWARE_FB0, (struct hw_device_t**)device);
+ GRALLOC_HARDWARE_FB0, TO_HW_DEVICE_T_OPEN(device));
}
static inline int framebuffer_close(struct framebuffer_device_t* device) {
diff --git a/include/hardware/gralloc.h b/include/hardware/gralloc.h
index 779915c..3d5b91f 100644
--- a/include/hardware/gralloc.h
+++ b/include/hardware/gralloc.h
@@ -372,7 +372,7 @@
static inline int gralloc_open(const struct hw_module_t* module,
struct alloc_device_t** device) {
return module->methods->open(module,
- GRALLOC_HARDWARE_GPU0, (struct hw_device_t**)device);
+ GRALLOC_HARDWARE_GPU0, TO_HW_DEVICE_T_OPEN(device));
}
static inline int gralloc_close(struct alloc_device_t* device) {
diff --git a/include/hardware/gralloc1.h b/include/hardware/gralloc1.h
index 58c0e33..a1a2d69 100644
--- a/include/hardware/gralloc1.h
+++ b/include/hardware/gralloc1.h
@@ -290,7 +290,7 @@
static inline int gralloc1_open(const struct hw_module_t* module,
gralloc1_device_t** device) {
return module->methods->open(module, GRALLOC_HARDWARE_MODULE_ID,
- (struct hw_device_t**) device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int gralloc1_close(gralloc1_device_t* device) {
diff --git a/include/hardware/hardware.h b/include/hardware/hardware.h
index 74f57aa..bf076f6 100644
--- a/include/hardware/hardware.h
+++ b/include/hardware/hardware.h
@@ -201,6 +201,12 @@
} hw_device_t;
+#ifdef __cplusplus
+#define TO_HW_DEVICE_T_OPEN(x) reinterpret_cast<struct hw_device_t**>(x)
+#else
+#define TO_HW_DEVICE_T_OPEN(x) (struct hw_device_t**)(x)
+#endif
+
/**
* Name of the hal_module_info
*/
diff --git a/include/hardware/hdmi_cec.h b/include/hardware/hdmi_cec.h
index ab70f92..aa06384 100644
--- a/include/hardware/hdmi_cec.h
+++ b/include/hardware/hdmi_cec.h
@@ -417,7 +417,7 @@
static inline int hdmi_cec_open(const struct hw_module_t* module,
struct hdmi_cec_device** device) {
return module->methods->open(module,
- HDMI_CEC_HARDWARE_INTERFACE, (struct hw_device_t**)device);
+ HDMI_CEC_HARDWARE_INTERFACE, TO_HW_DEVICE_T_OPEN(device));
}
static inline int hdmi_cec_close(struct hdmi_cec_device* device) {
diff --git a/include/hardware/hwcomposer.h b/include/hardware/hwcomposer.h
index 61218bb..7eca7c1 100644
--- a/include/hardware/hwcomposer.h
+++ b/include/hardware/hwcomposer.h
@@ -783,7 +783,7 @@
static inline int hwc_open_1(const struct hw_module_t* module,
hwc_composer_device_1_t** device) {
return module->methods->open(module,
- HWC_HARDWARE_COMPOSER, (struct hw_device_t**)device);
+ HWC_HARDWARE_COMPOSER, TO_HW_DEVICE_T_OPEN(device));
}
static inline int hwc_close_1(hwc_composer_device_1_t* device) {
diff --git a/include/hardware/hwcomposer2.h b/include/hardware/hwcomposer2.h
index 6973603..35eedb0 100644
--- a/include/hardware/hwcomposer2.h
+++ b/include/hardware/hwcomposer2.h
@@ -17,6 +17,8 @@
#ifndef ANDROID_HARDWARE_HWCOMPOSER2_H
#define ANDROID_HARDWARE_HWCOMPOSER2_H
+#include <sys/cdefs.h>
+
#include <hardware/hardware.h>
#include "hwcomposer_defs.h"
@@ -360,7 +362,7 @@
static inline const char* getDisplayRequestName(
hwc2_display_request_t request) {
- switch (request) {
+ switch (__BIONIC_CAST(static_cast, int, request)) {
case 0: return "None";
case HWC2_DISPLAY_REQUEST_FLIP_CLIENT_TARGET: return "FlipClientTarget";
case HWC2_DISPLAY_REQUEST_WRITE_CLIENT_TARGET_TO_OUTPUT:
@@ -459,7 +461,7 @@
}
static inline const char* getLayerRequestName(hwc2_layer_request_t request) {
- switch (request) {
+ switch (__BIONIC_CAST(static_cast, int, request)) {
case 0: return "None";
case HWC2_LAYER_REQUEST_CLEAR_CLIENT_TARGET: return "ClearClientTarget";
default: return "Unknown";
@@ -477,7 +479,7 @@
}
static inline const char* getTransformName(hwc_transform_t transform) {
- switch (transform) {
+ switch (__BIONIC_CAST(static_cast, int, transform)) {
case 0: return "None";
case HWC_TRANSFORM_FLIP_H: return "FlipH";
case HWC_TRANSFORM_FLIP_V: return "FlipV";
@@ -738,7 +740,7 @@
static inline int hwc2_open(const struct hw_module_t* module,
hwc2_device_t** device) {
return module->methods->open(module, HWC_HARDWARE_COMPOSER,
- (struct hw_device_t**) device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int hwc2_close(hwc2_device_t* device) {
diff --git a/include/hardware/keymaster0.h b/include/hardware/keymaster0.h
index f020e5b..52ac64b 100644
--- a/include/hardware/keymaster0.h
+++ b/include/hardware/keymaster0.h
@@ -134,7 +134,7 @@
keymaster0_device_t** device)
{
int rc = module->methods->open(module, KEYSTORE_KEYMASTER,
- (struct hw_device_t**) device);
+ TO_HW_DEVICE_T_OPEN(device));
return rc;
}
diff --git a/include/hardware/keymaster1.h b/include/hardware/keymaster1.h
index afd202c..9969380 100644
--- a/include/hardware/keymaster1.h
+++ b/include/hardware/keymaster1.h
@@ -536,7 +536,7 @@
/* Convenience API for opening and closing keymaster devices */
static inline int keymaster1_open(const struct hw_module_t* module, keymaster1_device_t** device) {
- return module->methods->open(module, KEYSTORE_KEYMASTER, (struct hw_device_t**)device);
+ return module->methods->open(module, KEYSTORE_KEYMASTER, TO_HW_DEVICE_T_OPEN(device));
}
static inline int keymaster1_close(keymaster1_device_t* device) {
diff --git a/include/hardware/keymaster2.h b/include/hardware/keymaster2.h
index 565ad2e..f1993f8 100644
--- a/include/hardware/keymaster2.h
+++ b/include/hardware/keymaster2.h
@@ -420,7 +420,7 @@
/* Convenience API for opening and closing keymaster devices */
static inline int keymaster2_open(const struct hw_module_t* module, keymaster2_device_t** device) {
- return module->methods->open(module, KEYSTORE_KEYMASTER, (struct hw_device_t**)device);
+ return module->methods->open(module, KEYSTORE_KEYMASTER, TO_HW_DEVICE_T_OPEN(device));
}
static inline int keymaster2_close(keymaster2_device_t* device) {
diff --git a/include/hardware/local_time_hal.h b/include/hardware/local_time_hal.h
index 946e799..1bbbf11 100644
--- a/include/hardware/local_time_hal.h
+++ b/include/hardware/local_time_hal.h
@@ -109,7 +109,7 @@
struct local_time_hw_device** device)
{
return module->methods->open(module, LOCAL_TIME_HARDWARE_INTERFACE,
- (struct hw_device_t**)device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int local_time_hw_device_close(struct local_time_hw_device* device)
diff --git a/include/hardware/nvram.h b/include/hardware/nvram.h
index 859ea47..0654afe 100644
--- a/include/hardware/nvram.h
+++ b/include/hardware/nvram.h
@@ -326,7 +326,7 @@
static inline int nvram_open(const struct hw_module_t* module,
nvram_device_t** device) {
return module->methods->open(module, NVRAM_HARDWARE_DEVICE_ID,
- (struct hw_device_t**)device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int nvram_close(nvram_device_t* device) {
diff --git a/include/hardware/radio.h b/include/hardware/radio.h
index 145deb5..413f413 100644
--- a/include/hardware/radio.h
+++ b/include/hardware/radio.h
@@ -285,7 +285,7 @@
struct radio_hw_device** device)
{
return module->methods->open(module, RADIO_HARDWARE_DEVICE,
- (struct hw_device_t**)device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int radio_hw_device_close(const struct radio_hw_device* device)
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h
index 99c1147..d98c623 100644
--- a/include/hardware/sensors.h
+++ b/include/hardware/sensors.h
@@ -1152,7 +1152,7 @@
/**
* Enumerate all available sensors. The list is returned in "list".
- * @return number of sensors in the list
+ * return number of sensors in the list
*/
int (*get_sensors_list)(struct sensors_module_t* module,
struct sensor_t const** list);
@@ -1163,7 +1163,7 @@
* 0 - Normal operation. Default state of the module.
* 1 - Loopback mode. Data is injected for the supported
* sensors by the sensor service in this mode.
- * @return 0 on success
+ * return 0 on success
* -EINVAL if requested mode is not supported
* -EPERM if operation is not allowed
*/
@@ -1379,7 +1379,7 @@
/*
* Inject a single sensor sample to be to this device.
* data points to the sensor event to be injected
- * @return 0 on success
+ * return 0 on success
* -EPERM if operation is not allowed
* -EINVAL if sensor event cannot be injected
*/
@@ -1395,7 +1395,7 @@
static inline int sensors_open(const struct hw_module_t* module,
struct sensors_poll_device_t** device) {
return module->methods->open(module,
- SENSORS_HARDWARE_POLL, (struct hw_device_t**)device);
+ SENSORS_HARDWARE_POLL, TO_HW_DEVICE_T_OPEN(device));
}
static inline int sensors_close(struct sensors_poll_device_t* device) {
@@ -1405,7 +1405,7 @@
static inline int sensors_open_1(const struct hw_module_t* module,
sensors_poll_device_1_t** device) {
return module->methods->open(module,
- SENSORS_HARDWARE_POLL, (struct hw_device_t**)device);
+ SENSORS_HARDWARE_POLL, TO_HW_DEVICE_T_OPEN(device));
}
static inline int sensors_close_1(sensors_poll_device_1_t* device) {
diff --git a/include/hardware/sound_trigger.h b/include/hardware/sound_trigger.h
index e1abbc9..d7828ac 100644
--- a/include/hardware/sound_trigger.h
+++ b/include/hardware/sound_trigger.h
@@ -124,7 +124,7 @@
struct sound_trigger_hw_device** device)
{
return module->methods->open(module, SOUND_TRIGGER_HARDWARE_INTERFACE,
- (struct hw_device_t**)device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int sound_trigger_hw_device_close(struct sound_trigger_hw_device* device)
diff --git a/include/hardware/vibrator.h b/include/hardware/vibrator.h
index 200adf0..361085f 100644
--- a/include/hardware/vibrator.h
+++ b/include/hardware/vibrator.h
@@ -65,7 +65,7 @@
static inline int vibrator_open(const struct hw_module_t* module, vibrator_device_t** device)
{
- return module->methods->open(module, VIBRATOR_DEVICE_ID_MAIN, (struct hw_device_t**)device);
+ return module->methods->open(module, VIBRATOR_DEVICE_ID_MAIN, TO_HW_DEVICE_T_OPEN(device));
}
__END_DECLS