Add null check for default proximity sensor.

Without this we fail to boot on devices without a proximity sensor,
such as FVP.

Bug: 142352330
Change-Id: I474628d7ba32a9178fd720563fe2eca177920203
Merged-In: I474628d7ba32a9178fd720563fe2eca177920203
This commit is contained in:
Peter Collingbourne
2020-04-30 18:12:39 -07:00
committed by Dave Mankoff
parent dae7609a1a
commit 67a07c2223

View File

@@ -44,7 +44,7 @@ public class SensorModule {
Sensor defaultSensor = sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
return thresholdSensorBuilder
.setSensor(defaultSensor)
.setThresholdValue(defaultSensor.getMaximumRange())
.setThresholdValue(defaultSensor != null ? defaultSensor.getMaximumRange() : 0)
.build();
}
}