diff options
author | Mathias Agopian <mathias@google.com> | 2011-11-07 21:21:47 -0800 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2011-11-07 21:21:47 -0800 |
commit | eed2373321a84560961884697b4bd92d0ee9f7c9 (patch) | |
tree | 04086bf7f7888acab53a6ca328a44359badcfcc9 /services/sensorservice/SensorService.cpp | |
parent | 2f99bb5e4f706fee3dc1e08bdd66f58ea9844b09 (diff) | |
download | frameworks_base-eed2373321a84560961884697b4bd92d0ee9f7c9.zip frameworks_base-eed2373321a84560961884697b4bd92d0ee9f7c9.tar.gz frameworks_base-eed2373321a84560961884697b4bd92d0ee9f7c9.tar.bz2 |
SensorService now always clamps the requested rate
Requested rate will be clamped to the minimum rate and then
to 1ms. Previously we would return an error if a lower
rate was asked. The SensorManager documentation wording
allows this change.
We do this to get more consistancy between all the sensor
drivers / HALs
Change-Id: I199f76486fb76ccbb11e7280460a03726c767e84
Diffstat (limited to 'services/sensorservice/SensorService.cpp')
-rw-r--r-- | services/sensorservice/SensorService.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index d2d2d8b..c2c6b4d 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -478,8 +478,9 @@ status_t SensorService::setEventRate(const sp<SensorEventConnection>& connection if (ns < 0) return BAD_VALUE; - if (ns == 0) { - ns = sensor->getSensor().getMinDelayNs(); + nsecs_t minDelayNs = sensor->getSensor().getMinDelayNs(); + if (ns < minDelayNs) { + ns = minDelayNs; } if (ns < MINIMUM_EVENTS_PERIOD) |