diff options
author | Mathias Agopian <mathias@google.com> | 2013-09-09 23:36:25 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2013-09-10 21:10:53 -0700 |
commit | 90ed3e8d7883d9c80fb8bf11b1c593bd8b2b39d0 (patch) | |
tree | 18e3cac4c05f7b19989dff34b507118c44bbd59b /services | |
parent | 63108c34ec181e923b68ee840bb7960f205466a7 (diff) | |
download | frameworks_native-90ed3e8d7883d9c80fb8bf11b1c593bd8b2b39d0.zip frameworks_native-90ed3e8d7883d9c80fb8bf11b1c593bd8b2b39d0.tar.gz frameworks_native-90ed3e8d7883d9c80fb8bf11b1c593bd8b2b39d0.tar.bz2 |
fix a few problems with BitTube
BitTube used to send objects one at a time and didn't
handle errors properly.
We now send all the objects in one call, which means they
have to be read as a single batch as well. This changes the
BitTube API.
Update SensorService to the new API.
Also added an API to set the size of the send buffer.
Bug: 10641596
Change-Id: I77c70d35e351fdba0416fae4b7ca3b1d56272251
Diffstat (limited to 'services')
-rw-r--r-- | services/sensorservice/SensorService.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index 7bb6e86..cb99531 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -292,8 +292,12 @@ bool SensorService::threadLoop() { ALOGD("nuSensorService thread starting..."); - const size_t numEventMax = 16; - const size_t minBufferSize = numEventMax + numEventMax * mVirtualSensorList.size(); + // each virtual sensor could generate an event per "real" event, that's why we need + // to size numEventMax much smaller than MAX_RECEIVE_BUFFER_EVENT_COUNT. + // in practice, this is too aggressive, but guaranteed to be enough. + const size_t minBufferSize = SensorEventQueue::MAX_RECEIVE_BUFFER_EVENT_COUNT; + const size_t numEventMax = minBufferSize / (1 + mVirtualSensorList.size()); + sensors_event_t buffer[minBufferSize]; sensors_event_t scratch[minBufferSize]; SensorDevice& device(SensorDevice::getInstance()); |