summaryrefslogtreecommitdiffstats
path: root/services/sensorservice/SensorService.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-11-07 21:21:47 -0800
committerMathias Agopian <mathias@google.com>2011-11-07 21:21:47 -0800
commiteed2373321a84560961884697b4bd92d0ee9f7c9 (patch)
tree04086bf7f7888acab53a6ca328a44359badcfcc9 /services/sensorservice/SensorService.cpp
parent2f99bb5e4f706fee3dc1e08bdd66f58ea9844b09 (diff)
downloadframeworks_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.cpp5
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)