From 33264868ba0aaccb9d4b5e5a067a79a43633f6ec Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Thu, 28 Jun 2012 19:46:54 -0700 Subject: [PATCH] add a way to enable debugging sensors at runtime if debug.sensors is true, extra debugging sensors are enabled and HAL provided sensor fusion is disabled Change-Id: I9b093424edb8c5363d1337237cdf6abe4ab266f9 --- services/sensorservice/SensorService.cpp | 34 +++++++++++++++++++----- services/sensorservice/SensorService.h | 1 + 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index 9e5e84b38..7ab34c968 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -117,17 +117,16 @@ void SensorService::onFirstRef() // these are optional registerVirtualSensor( new OrientationSensor() ); registerVirtualSensor( new CorrectedGyroSensor(list, count) ); - - // virtual debugging sensors... - char value[PROPERTY_VALUE_MAX]; - property_get("debug.sensors", value, "0"); - if (atoi(value)) { - registerVirtualSensor( new GyroDriftSensor() ); - } } // build the sensor list returned to users mUserSensorList = mSensorList; + + if (hasGyro) { + // virtual debugging sensors are not added to mUserSensorList + registerVirtualSensor( new GyroDriftSensor() ); + } + if (hasGyro && (virtualSensorsNeeds & (1< SensorService::getSensorList() { + char value[PROPERTY_VALUE_MAX]; + property_get("debug.sensors", value, "0"); + if (atoi(value)) { + return mUserSensorListDebug; + } return mUserSensorList; } diff --git a/services/sensorservice/SensorService.h b/services/sensorservice/SensorService.h index e357f967c..54a76e820 100644 --- a/services/sensorservice/SensorService.h +++ b/services/sensorservice/SensorService.h @@ -113,6 +113,7 @@ class SensorService : // constants Vector mSensorList; + Vector mUserSensorListDebug; Vector mUserSensorList; DefaultKeyedVector mSensorMap; Vector mVirtualSensorList;