We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 45a04db + f61acda commit 515c6b4Copy full SHA for 515c6b4
services/sensorservice/SensorService.cpp
@@ -471,14 +471,20 @@ status_t SensorService::setEventRate(const sp<SensorEventConnection>& connection
471
if (mInitCheck != NO_ERROR)
472
return mInitCheck;
473
474
+ SensorInterface* sensor = mSensorMap.valueFor(handle);
475
+ if (!sensor)
476
+ return BAD_VALUE;
477
+
478
if (ns < 0)
479
return BAD_VALUE;
480
481
+ if (ns == 0) {
482
+ ns = sensor->getSensor().getMinDelayNs();
483
+ }
484
485
if (ns < MINIMUM_EVENTS_PERIOD)
486
ns = MINIMUM_EVENTS_PERIOD;
487
- SensorInterface* sensor = mSensorMap.valueFor(handle);
- if (!sensor) return BAD_VALUE;
488
return sensor->setDelay(connection.get(), handle, ns);
489
}
490
0 commit comments