summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-07-21 16:12:28 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-07-21 16:12:28 -0700
commit1f2ec4070aa9c999d41dc50a892a896e894c5710 (patch)
tree414a41e63ed44ad1305e7422a114a5b844297a94 /services
parent994fff705ee8a7a8e9826ade53a5220949a28192 (diff)
parent23e8de26b7b3d04daf08526f314c2fdd2f8fee65 (diff)
downloadframeworks_base-1f2ec4070aa9c999d41dc50a892a896e894c5710.zip
frameworks_base-1f2ec4070aa9c999d41dc50a892a896e894c5710.tar.gz
frameworks_base-1f2ec4070aa9c999d41dc50a892a896e894c5710.tar.bz2
am 23e8de26: propagate sensor event rate properly
Merge commit '23e8de26b7b3d04daf08526f314c2fdd2f8fee65' into gingerbread-plus-aosp * commit '23e8de26b7b3d04daf08526f314c2fdd2f8fee65': propagate sensor event rate properly
Diffstat (limited to 'services')
-rw-r--r--services/sensorservice/SensorService.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index fec9153..a4f6549 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -77,6 +77,9 @@ ANDROID_SINGLETON_STATIC_INSTANCE(BatteryService)
// ---------------------------------------------------------------------------
+// 100 events/s max
+static const nsecs_t MINIMUM_EVENT_PERIOD = ms2ns(10);
+
SensorService::SensorService()
: Thread(false),
mSensorDevice(0),
@@ -284,7 +287,6 @@ status_t SensorService::disable(const sp<SensorEventConnection>& connection,
status_t err = NO_ERROR;
Mutex::Autolock _l(mLock);
SensorRecord* rec = mActiveSensors.valueFor(handle);
- LOGW("sensor (handle=%d) is not enabled", handle);
if (rec) {
// see if this connection becomes inactive
connection->removeSensor(handle);
@@ -310,6 +312,12 @@ status_t SensorService::setRate(const sp<SensorEventConnection>& connection,
if (mInitCheck != NO_ERROR)
return mInitCheck;
+ if (ns < 0)
+ return BAD_VALUE;
+
+ if (ns < MINIMUM_EVENT_PERIOD)
+ ns = MINIMUM_EVENT_PERIOD;
+
status_t err = NO_ERROR;
Mutex::Autolock _l(mLock);