DO NOT MERGE Set the sensor threshold only if sensor exists

Bug: 150779130
Test: atest SystemUITests and manual test for automotive
Change-Id: I18e3584c66f1286713a6fdadc678a9048869913b
This commit is contained in:
Heemin Seog
2020-03-04 12:19:37 -08:00
parent 8af68ccfb5
commit 06a7bf9e9e

View File

@@ -305,7 +305,7 @@ public class DozeSensors {
mContext.getResources());
} else {
sensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
mSensorThreshold = sensor.getMaximumRange();
mSensorThreshold = sensor == null ? 0 : sensor.getMaximumRange();
}
mSensor = sensor;
}