Here is a dirty hack for people who have issues with the proximity sensor e.g. in cases where the incallui goes black.
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
index e4efde2448..59de934888 100644
--- a/services/sensorservice/SensorDevice.cpp
+++ b/services/sensorservice/SensorDevice.cpp
@@ -166,6 +166,12 @@ void SensorDevice::initializeSensorList() {
// Don't crash here or the device will go into a crashloop.
ALOGW("%s should have a non-zero resolution", sensor.name);
}
+
+ // DIM
+ if (!strcmp(sensor.name, "APDS-9910 Proximity")) {
+ sensor.maxRange = 4;
+ ALOGW("-DIM- APDS-9910 Proximity: setting maxRange to 4");
+ }
}
// Sanity check and clamp power if it is 0 (or close)
On my device (Z5) the sensor reports its maxrange as 5.03...cm however the actual distance when nothing is in front of the sensor is reported as 4.9..... cm. The incallui checks if the current proximity value is smaller than maxrange - if true the screen goes dark.
Edit: You might have to change the sensor.name on Z5C devices.