sensors: get rid of com.samsung.permission.SSENSOR
authorWilli Ye <williye97@gmail.com>
Sun, 8 Sep 2019 16:23:04 +0000 (18:23 +0200)
committerJesse Chan <jc@lineageos.org>
Fri, 15 May 2020 14:06:48 +0000 (22:06 +0800)
Samsung uses a permission com.samsung.permission.SSENSOR
for Samsung-specfic sensors. Android obviously does not
have that and the default is denied when there is no
permission. As such, those sensors are inaccessible.

Thus, this change removes this permission from those sensors
so we can use them.

Android does not require special permissions for most sensors
so this change doesn't attach additional permission requirements
to those sensors.

However, note that it is possible that some sensitive sensors
introduced by Samsung in the future may use SSENSOR permission
and for privacy reasons they should be handled separately with
appropriate permission control attached.

Change-Id: Ia3033898722039b285e522e226074238508f6093
Signed-off-by: Jesse Chan <jc@lineageos.org>
hidl/sensors/Sensors.cpp

index 678ac72b4437286db7e89b68ba2bdd51e9a42557..a242e375312350b48e7b7de2b0adf56ca08cf19b 100644 (file)
@@ -125,6 +125,10 @@ Return<void> Sensors::getSensorsList(getSensorsList_cb _hidl_cb) {
         SensorInfo *dst = &out[i];
 
         convertFromSensor(*src, dst);
+
+        if (dst->requiredPermission == "com.samsung.permission.SSENSOR") {
+            dst->requiredPermission = "";
+        }
     }
 
     _hidl_cb(out);