sensorservice: Register orientation sensor if HAL doesn't provide it
* In KitKat and on most Samsung devices, the orientation sensor is not getting registered, and makes the compass non-working in a lot of apps. This patch enables the sensor for such devices. Change-Id: I0ebba72ec4aa2cfa02c21a6daff0c356c6793fd0 (cherry picked from commit 98fa6f1152da759ef3eaf36cb16e0aaf2013376a)
This commit is contained in:
parent
c77679141d
commit
4cf9742078
@ -146,10 +146,15 @@ void SensorService::onFirstRef()
|
|||||||
|
|
||||||
aSensor = registerVirtualSensor( new OrientationSensor() );
|
aSensor = registerVirtualSensor( new OrientationSensor() );
|
||||||
if (virtualSensorsNeeds & (1<<SENSOR_TYPE_ROTATION_VECTOR)) {
|
if (virtualSensorsNeeds & (1<<SENSOR_TYPE_ROTATION_VECTOR)) {
|
||||||
|
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
|
// if we are doing our own rotation-vector, also add
|
||||||
// the orientation sensor and remove the HAL provided one.
|
// the orientation sensor and remove the HAL provided one.
|
||||||
mUserSensorList.replaceAt(aSensor, orientationIndex);
|
mUserSensorList.replaceAt(aSensor, orientationIndex);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// virtual debugging sensors are not added to mUserSensorList
|
// virtual debugging sensors are not added to mUserSensorList
|
||||||
registerVirtualSensor( new CorrectedGyroSensor(list, count) );
|
registerVirtualSensor( new CorrectedGyroSensor(list, count) );
|
||||||
|
Loading…
Reference in New Issue
Block a user