PowerManager: Require proximity sensor value be less than Sensor.getMaximumRange()
This allows us to support binary proximity sensors that only return 0.0 and 1.0 Change-Id: Ifaf3a4e6fc720cb246ac3558e3e733b4b612c95b Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
@@ -2131,7 +2131,9 @@ class PowerManagerService extends IPowerManager.Stub
|
||||
long milliseconds = event.timestamp / 1000000;
|
||||
synchronized (mLocks) {
|
||||
float distance = event.values[0];
|
||||
if (distance >= 0.0 && distance < PROXIMITY_THRESHOLD) {
|
||||
// compare against getMaximumRange to support sensors that only return 0 or 1
|
||||
if (distance >= 0.0 && distance < PROXIMITY_THRESHOLD &&
|
||||
distance < mProximitySensor.getMaximumRange()) {
|
||||
if (mSpew) {
|
||||
Log.d(TAG, "onSensorChanged: proximity active, distance: " + distance);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user