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;