Fix security vulnerability: potential OOB write in audioserver am: 3f9a6d3bd9 am: 28d8817df3 am: 750a6a4ed8 am: 559dbde531 am: 4654f9ab8b am: 4154f08e79 am: 2ebeab8c6b
am: c196433170
Change-Id: Ib2c430673490d56347b7c5719ae9ac222129d046
diff --git a/include/hardware/bluetooth.h b/include/hardware/bluetooth.h
index 68cbd1e..0f1a35b 100644
--- a/include/hardware/bluetooth.h
+++ b/include/hardware/bluetooth.h
@@ -438,7 +438,7 @@
int (*init)(bt_callbacks_t* callbacks );
/** Enable Bluetooth. */
- int (*enable)(bool guest_mode);
+ int (*enable)(void);
/** Disable Bluetooth. */
int (*disable)(void);
diff --git a/include/hardware/power.h b/include/hardware/power.h
index 10612f3..8da1f98 100644
--- a/include/hardware/power.h
+++ b/include/hardware/power.h
@@ -46,7 +46,11 @@
*/
POWER_HINT_VIDEO_ENCODE = 0x00000003,
POWER_HINT_VIDEO_DECODE = 0x00000004,
- POWER_HINT_LOW_POWER = 0x00000005
+ POWER_HINT_LOW_POWER = 0x00000005,
+ POWER_HINT_FOREGROUND_LOAD = 0x00000006,
+ POWER_HINT_VR_MODE = 0x00000007,
+ POWER_HINT_LAUNCH = 0x00000008,
+ POWER_HINT_DISABLE_TOUCH = 0x00000009
} power_hint_t;
typedef enum {
@@ -126,6 +130,14 @@
* parameter is non-zero when low power mode is activated, and zero
* when deactivated.
*
+ * POWER_HINT_DISABLE_TOUCH
+ *
+ * When device enters some special modes, e.g. theater mode in Android
+ * Wear, there is no touch interaction expected between device and user.
+ * Touch controller could be disabled in those modes to save power.
+ * The data parameter is non-zero when touch could be disabled, and zero
+ * when touch needs to be re-enabled.
+ *
* A particular platform may choose to ignore any hint.
*
* availability: version 0.2
diff --git a/modules/sensors/multihal.cpp b/modules/sensors/multihal.cpp
index cd67f6d..6536882 100644
--- a/modules/sensors/multihal.cpp
+++ b/modules/sensors/multihal.cpp
@@ -34,6 +34,8 @@
#include <dlfcn.h>
#include <SensorEventQueue.h>
+#include <limits.h>
+#include <stdlib.h>
static const char* CONFIG_FILENAME = "/system/etc/sensors/hals.conf";
static const char* LEGAL_SUBHAL_PATH_PREFIX = "/system/lib/hw/";
@@ -127,7 +129,7 @@
return global_handle;
}
-static const int SENSOR_EVENT_QUEUE_CAPACITY = 20;
+static const int SENSOR_EVENT_QUEUE_CAPACITY = 36;
struct TaskContext {
sensors_poll_device_t* device;
@@ -153,7 +155,11 @@
ALOGV("writerTask before poll() - bufferSize = %d", bufferSize);
eventsPolled = device->poll(device, buffer, bufferSize);
ALOGV("writerTask poll() got %d events.", eventsPolled);
- if (eventsPolled == 0) {
+ if (eventsPolled <= 0) {
+ if (eventsPolled < 0) {
+ ALOGV("writerTask ignored error %d from %s", eventsPolled, device->common.module->name);
+ ALOGE("ERROR: Fix %s so it does not return error from poll()", device->common.module->name);
+ }
continue;
}
pthread_mutex_lock(&queue_mutex);