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

Commit 5f43c96a authored by Mathias Agopian's avatar Mathias Agopian Committed by Android Git Automerger
Browse files

am 515c6b44: Merge "fix an issue where SensorService could request an invalid...

am 515c6b44: Merge "fix an issue where SensorService could request an invalid sensor delay" into ics-mr1

* commit '515c6b44':
  fix an issue where SensorService could request an invalid sensor delay
parents a4e1014d 515c6b44
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -471,14 +471,20 @@ status_t SensorService::setEventRate(const sp<SensorEventConnection>& connection
    if (mInitCheck != NO_ERROR)
        return mInitCheck;

    SensorInterface* sensor = mSensorMap.valueFor(handle);
    if (!sensor)
        return BAD_VALUE;

    if (ns < 0)
        return BAD_VALUE;

    if (ns == 0) {
        ns = sensor->getSensor().getMinDelayNs();
    }

    if (ns < MINIMUM_EVENTS_PERIOD)
        ns = MINIMUM_EVENTS_PERIOD;

    SensorInterface* sensor = mSensorMap.valueFor(handle);
    if (!sensor) return BAD_VALUE;
    return sensor->setDelay(connection.get(), handle, ns);
}