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 <jc@lineageos.org>
tirimbino
Willi Ye 5 years ago committed by Jesse Chan
parent 834dfaa39b
commit 80c90e970e
  1. 6
      hidl/sensors/Sensors.cpp

@ -129,6 +129,12 @@ Return<void> 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);

Loading…
Cancel
Save