sensors: set max range of proximity sensor to 1
authorJesse Chan <jc@lineageos.org>
Sat, 16 May 2020 13:17:25 +0000 (21:17 +0800)
committerJan Altensen <info@stricted.net>
Tue, 19 May 2020 09:27:32 +0000 (11:27 +0200)
Samsung's proximity sensor type is binary in nature.
There are only two state: FAR and NEAR.

However, Samsung uses values between min and max for
other purposes like proximity detection during Always-On
Display.

This breaks proximity detection during Doze for AOSP as
AOSP only considers the proximity sensor in FAR state
when the value equals or larger than max.

Thus, this change sets the max to 1 so any > 1 value
would be considered as FAR and the behavior of this vendor
proximity sensor type matches the behavior expected by AOSP.

Change-Id: I56af8e2ae743b47e3c4894e5ef68ce0b54e5cfdb

hidl/sensors/Sensors.cpp

index e9fc5cee15d5870e0a4f322e7627f04818b583b5..d4e84b34219ff742323d99c27d319fe072c59b86 100644 (file)
@@ -137,6 +137,7 @@ Return<void> Sensors::getSensorsList(getSensorsList_cb _hidl_cb) {
             LOG(INFO) << "Fixing com.samsung.sensor.physical_proximity";
             dst->type = SensorType::PROXIMITY;
             dst->typeAsString = SENSOR_STRING_TYPE_PROXIMITY;
+            dst->maxRange = 1;
         }
     }