From e8293118b93ff33ce6a686b6d7c500ae9adb2bc9 Mon Sep 17 00:00:00 2001 From: Prashant Malani Date: Thu, 20 Aug 2015 17:19:05 -0700 Subject: [PATCH] Add body sensors app op for custom sensors If the custom sensor requires the BODY SENSOR permission, we should add the body sensors app op for the custom sensor Bug: 23396558 Change-Id: I132917d1bca12c76c8a9fb146e00951cba3e6d7a --- libs/gui/Sensor.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/gui/Sensor.cpp b/libs/gui/Sensor.cpp index 2545eec33..4b3603ee1 100644 --- a/libs/gui/Sensor.cpp +++ b/libs/gui/Sensor.cpp @@ -223,6 +223,10 @@ Sensor::Sensor(struct sensor_t const* hwSensor, int halVersion) } if (halVersion > SENSORS_DEVICE_API_VERSION_1_0 && hwSensor->requiredPermission) { mRequiredPermission = hwSensor->requiredPermission; + if (!strcmp(mRequiredPermission, SENSOR_PERMISSION_BODY_SENSORS)) { + AppOpsManager appOps; + mRequiredAppOp = appOps.permissionToOpCode(String16(SENSOR_PERMISSION_BODY_SENSORS)); + } } if (halVersion >= SENSORS_DEVICE_API_VERSION_1_3) {