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

Commit eed62260 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "sensors: Fix ALS and PS lag on back-compat layer" into gingerbread

parents 753dc288 5deda01b
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -226,17 +226,24 @@ ssize_t SensorDevice::poll(sensors_event_t* buffer, size_t count) {
            buffer[pollsDone].acceleration = oldBuffer.vector;
            buffer[pollsDone].temperature = oldBuffer.temperature;
            LOGV("Adding results for sensor %d", buffer[pollsDone].sensor);
            /* The ALS and PS sensors only report values on change,
             * instead of a data "stream" like the others. So don't wait
             * for the number of requested samples to fill, and deliver
             * it immediately */
            if (sensorType == SENSOR_TYPE_PROXIMITY) {
#ifdef FOXCONN_SENSORS
            /* Fix ridiculous API breakages from FIH. */
            /* These idiots are returning -1 for FAR, and 1 for NEAR */
            if (sensorType == SENSOR_TYPE_PROXIMITY) {
                if (buffer[pollsDone].distance > 0) {
                    buffer[pollsDone].distance = 0;
                } else {
                    buffer[pollsDone].distance = 1;
                }
            }
#endif
		return pollsDone+1;
            } else if (sensorType == SENSOR_TYPE_LIGHT) {
		return pollsDone+1;
            }
            pollsDone++;
        }
        return pollsDone;