summaryrefslogtreecommitdiffstats
path: root/services/sensorservice/SensorService.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/sensorservice/SensorService.cpp')
-rw-r--r--services/sensorservice/SensorService.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 313011a..2d35fe9 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -146,9 +146,14 @@ void SensorService::onFirstRef()
aSensor = registerVirtualSensor( new OrientationSensor() );
if (virtualSensorsNeeds & (1<<SENSOR_TYPE_ROTATION_VECTOR)) {
- // if we are doing our own rotation-vector, also add
- // the orientation sensor and remove the HAL provided one.
- mUserSensorList.replaceAt(aSensor, orientationIndex);
+ if (orientationIndex == -1) {
+ // some sensor HALs don't provide an orientation sensor.
+ mUserSensorList.add(aSensor);
+ } else {
+ // if we are doing our own rotation-vector, also add
+ // the orientation sensor and remove the HAL provided one.
+ mUserSensorList.replaceAt(aSensor, orientationIndex);
+ }
}
// virtual debugging sensors are not added to mUserSensorList