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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -286,7 +286,8 @@ bool SensorService::threadLoop()
|
||||
}
|
||||
} while (count >= 0 || Thread::exitPending());
|
||||
|
||||
LOGW("Exiting SensorService::threadLoop!");
|
||||
LOGW("Exiting SensorService::threadLoop => aborting...");
|
||||
abort();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user