Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06a1765b authored by Arne Coucheron's avatar Arne Coucheron Committed by Steve Kondik
Browse files

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 98fa6f11)
parent 1c3f78f8
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -138,10 +138,15 @@ void SensorService::onFirstRef()

                aSensor = registerVirtualSensor( new OrientationSensor() );
                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
                        // the orientation sensor and remove the HAL provided one.
                        mUserSensorList.replaceAt(aSensor, orientationIndex);
                    }
                }

                // virtual debugging sensors are not added to mUserSensorList
                registerVirtualSensor( new CorrectedGyroSensor(list, count) );