From 80c90e970e7f57c91feee265517df878f7c3ddbb Mon Sep 17 00:00:00 2001 From: Willi Ye Date: Sun, 8 Sep 2019 18:23:04 +0200 Subject: [PATCH] sensors: map Samsung proximity sensor type to generic Samsung uses their own com.samsung.sensor.physical_proximity type instead of SENSOR_TYPE_PROXIMITY of Android. This makes proximity sensor unavailable for us as we only look for SENSOR_TYPE_PROXIMITY. Thus, this change maps Samsung's vendor-specific proximity sensor type to generic one. Change-Id: I64f6558876e1398dfbea0e5c0eb76aa1aafd2dfd Signed-off-by: Jesse Chan --- hidl/sensors/Sensors.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hidl/sensors/Sensors.cpp b/hidl/sensors/Sensors.cpp index a242e375..a1cd153c 100644 --- a/hidl/sensors/Sensors.cpp +++ b/hidl/sensors/Sensors.cpp @@ -129,6 +129,12 @@ Return Sensors::getSensorsList(getSensorsList_cb _hidl_cb) { if (dst->requiredPermission == "com.samsung.permission.SSENSOR") { dst->requiredPermission = ""; } + + if (dst->typeAsString == "com.samsung.sensor.physical_proximity") { + LOG(INFO) << "Fixing com.samsung.sensor.physical_proximity"; + dst->type = SensorType::PROXIMITY; + dst->typeAsString = SENSOR_STRING_TYPE_PROXIMITY; + } } _hidl_cb(out);