DO NOT MERGE ANYWHERE Sensors: MultiHal: ignore errors from poll calls
MultiHal was not properly fielding errors from the poll() calls of
sub-HALs. Propagating errors received from sub-HALs up to Sensor
Services causes Sensor Services to abort, so instead of propagating
the error up to Sensor Services, the MultiHal logs a message to
logcat to fix the sub-HAL problem.
Bug: 30060537
Change-Id: I6e20c193a2f2d228da48cf3d5a23e439eaf663df
diff --git a/modules/sensors/multihal.cpp b/modules/sensors/multihal.cpp
index d1536f4..6536882 100644
--- a/modules/sensors/multihal.cpp
+++ b/modules/sensors/multihal.cpp
@@ -155,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);