From 561a3e7edcd15c2b93cd664ef0a9f4f36e442939 Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Sat, 16 May 2020 21:17:25 +0800 Subject: [PATCH] sensors: set max range of proximity sensor to 1 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/hidl/sensors/Sensors.cpp b/hidl/sensors/Sensors.cpp index e9fc5cee..d4e84b34 100644 --- a/hidl/sensors/Sensors.cpp +++ b/hidl/sensors/Sensors.cpp @@ -137,6 +137,7 @@ Return 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; } }