diff options
author | Mathias Agopian <mathias@google.com> | 2011-11-04 12:13:36 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-11-04 12:13:36 -0700 |
commit | 515c6b44d57b829792267594a355cd2831582197 (patch) | |
tree | 4f95fba8a8bf96f23665a5485adcc09bcff2e89d | |
parent | 45a04db3f95755829b24043d30d7da7182b4f33b (diff) | |
parent | f61acdac57ddac5ebc1b1ca009351fca86926152 (diff) | |
download | frameworks_base-515c6b44d57b829792267594a355cd2831582197.zip frameworks_base-515c6b44d57b829792267594a355cd2831582197.tar.gz frameworks_base-515c6b44d57b829792267594a355cd2831582197.tar.bz2 |
Merge "fix an issue where SensorService could request an invalid sensor delay" into ics-mr1
-rw-r--r-- | services/sensorservice/SensorService.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index 5b74fb8..d2d2d8b 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -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); } |