Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3bba6805 authored by Peng Xu's avatar Peng Xu Committed by android-build-merger
Browse files

Merge "Sensor: Limit delay to maximum possible value before sending to HAL"...

Merge "Sensor: Limit delay to maximum possible value before sending to HAL" into oc-dev am: 35c1e696
am: 91ce2645

Change-Id: I26f1d84f4b0ffd4457b36e864136e598a543b406
parents cdc3cdf2 91ce2645
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1249,6 +1249,12 @@ status_t SensorService::enable(const sp<SensorEventConnection>& connection,
            handle, connection.get());
    }

    // Check maximum delay for the sensor.
    nsecs_t maxDelayNs = sensor->getSensor().getMaxDelay() * 1000;
    if (maxDelayNs > 0 && (samplingPeriodNs > maxDelayNs)) {
        samplingPeriodNs = maxDelayNs;
    }

    nsecs_t minDelayNs = sensor->getSensor().getMinDelayNs();
    if (samplingPeriodNs < minDelayNs) {
        samplingPeriodNs = minDelayNs;