From a5b8e8bfa9f3416ce61ee08162fb139afde60488 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 18 Sep 2012 17:18:54 -0700 Subject: [PATCH] fix a typo in SensorService It shouldn't have caused much harm though. Also log a warning when enabling a sensor for a connection that is already enabled. Change-Id: Ia4a052381e79183cd4cb1bedc7ba08e5228d7a38 --- services/sensorservice/SensorService.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index 7ab34c968..c9b0f7c27 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -462,6 +462,9 @@ status_t SensorService::enable(const sp& connection, if (mActiveConnections.indexOf(connection) < 0) { mActiveConnections.add(connection); } + } else { + ALOGW("sensor %08x already enabled in connection %p (ignoring)", + handle, connection.get()); } } } @@ -567,7 +570,7 @@ void SensorService::SensorEventConnection::onFirstRef() bool SensorService::SensorEventConnection::addSensor(int32_t handle) { Mutex::Autolock _l(mConnectionLock); - if (mSensorInfo.indexOf(handle) <= 0) { + if (mSensorInfo.indexOf(handle) < 0) { mSensorInfo.add(handle); return true; }