summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-11-09 17:50:15 -0800
committerMathias Agopian <mathias@google.com>2011-11-09 17:53:14 -0800
commit37d95f6f91713825ebb5edd6ce4e376fc093a750 (patch)
treef46cd8bad02090a11c3330e404b5eac8a9cdc708 /services
parent270826a8878b5470d48d93ca3d518ac93860870d (diff)
downloadframeworks_base-37d95f6f91713825ebb5edd6ce4e376fc093a750.zip
frameworks_base-37d95f6f91713825ebb5edd6ce4e376fc093a750.tar.gz
frameworks_base-37d95f6f91713825ebb5edd6ce4e376fc093a750.tar.bz2
handle EINTR when calling sensor HAL's poll function
some sensor HALs don't handle EINTR, make sure to catch it in the sensorservice. also if we ever encounter an error that we can't handle, we abort which will restart us (or the whole system process if we're running in it) Bug: 5511741 Change-Id: I7051882b06980f778736b53d6cd021a99b5ca8d2
Diffstat (limited to 'services')
-rw-r--r--services/sensorservice/SensorDevice.cpp6
-rw-r--r--services/sensorservice/SensorService.cpp3
2 files changed, 7 insertions, 2 deletions
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
index d82a7e2..7575ebd 100644
--- a/services/sensorservice/SensorDevice.cpp
+++ b/services/sensorservice/SensorDevice.cpp
@@ -166,7 +166,11 @@ status_t SensorDevice::initCheck() const {
ssize_t SensorDevice::poll(sensors_event_t* buffer, size_t count) {
if (!mSensorDevice) return NO_INIT;
- return mSensorDevice->poll(mSensorDevice, buffer, count);
+ ssize_t c;
+ do {
+ c = mSensorDevice->poll(mSensorDevice, buffer, count);
+ } while (c == -EINTR);
+ return c;
}
status_t SensorDevice::activate(void* ident, int handle, int enabled)
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index c2c6b4d..6202143 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -286,7 +286,8 @@ bool SensorService::threadLoop()
}
} while (count >= 0 || Thread::exitPending());
- LOGW("Exiting SensorService::threadLoop!");
+ LOGW("Exiting SensorService::threadLoop => aborting...");
+ abort();
return false;
}