OSDN Git Service

DO NOT MERGE ANYWHERE Sensors: MultiHal: ignore errors from poll calls
authorNick Vaccaro <nvaccaro@google.com>
Tue, 19 Jul 2016 17:34:00 +0000 (10:34 -0700)
committerNick Vaccaro <nvaccaro@google.com>
Tue, 19 Jul 2016 23:43:21 +0000 (16:43 -0700)
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

modules/sensors/multihal.cpp

index d1536f4..6536882 100644 (file)
@@ -155,7 +155,11 @@ void *writerTask(void* ptr) {
         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);