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

Commit 949b9ff1 authored by Greg Kaiser's avatar Greg Kaiser Committed by Android (Google) Code Review
Browse files

Merge "docs: Mild fix to a sensors_overview code example" into nyc-dev

parents 98e386f6 027e3fbd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -465,6 +465,7 @@ private Sensor mSensor;
...

mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mSensor = null;

if (mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY) != null){
  List<Sensor> gravSensors = mSensorManager.getSensorList(Sensor.TYPE_GRAVITY);
@@ -476,7 +477,7 @@ if (mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY) != null){
    }
  }
}
else{
if (mSensor == null){
  // Use the accelerometer.
  if (mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) != null){
    mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);