Skip to content

Commit eed2373

Browse files
committed
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
1 parent 2f99bb5 commit eed2373

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

services/sensorservice/SensorService.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,9 @@ status_t SensorService::setEventRate(const sp<SensorEventConnection>& connection
478478
if (ns < 0)
479479
return BAD_VALUE;
480480

481-
if (ns == 0) {
482-
ns = sensor->getSensor().getMinDelayNs();
481+
nsecs_t minDelayNs = sensor->getSensor().getMinDelayNs();
482+
if (ns < minDelayNs) {
483+
ns = minDelayNs;
483484
}
484485

485486
if (ns < MINIMUM_EVENTS_PERIOD)

0 commit comments

Comments
 (0)