OSDN Git Service

sensor: Allow devices to skip the permission request
authorChristopher N. Hesse <raymanfx@gmail.com>
Sat, 28 Nov 2015 23:39:51 +0000 (00:39 +0100)
committerSteve Kondik <steve@cyngn.com>
Thu, 1 Sep 2016 06:33:23 +0000 (23:33 -0700)
This is needed by Samsung devices with pre-M sensor
blobs which have support for SENSOR_TYPE_HEART_RATE
or body sensors in general.
These HALs somehow segfault on the flagged code.

Change-Id: I698f4129e71b683f6f063f00da79f32a5f521149

libs/gui/Android.mk
libs/gui/Sensor.cpp

index 635020e..8c3c311 100644 (file)
@@ -93,6 +93,10 @@ ifeq ($(TARGET_BOARD_PLATFORM), tegra3)
        LOCAL_CFLAGS += -DDONT_USE_FENCE_SYNC
 endif
 
+ifeq ($(TARGET_NO_SENSOR_PERMISSION_CHECK),true)
+LOCAL_CPPFLAGS += -DNO_SENSOR_PERMISSION_CHECK
+endif
+
 include $(BUILD_SHARED_LIBRARY)
 
 ifeq (,$(ONE_SHOT_MAKEFILE))
index 053d153..9d0aa24 100644 (file)
@@ -297,6 +297,7 @@ Sensor::Sensor(struct sensor_t const& hwSensor, const uuid_t& uuid, int halVersi
         mFlags |= (hwSensor.flags & DATA_INJECTION_MASK);
     }
 
+#ifndef NO_SENSOR_PERMISSION_CHECK
     if (mRequiredPermission.length() > 0) {
         // If the sensor is protected by a permission we need to know if it is
         // a runtime one to determine whether we can use the permission cache.
@@ -307,6 +308,7 @@ Sensor::Sensor(struct sensor_t const& hwSensor, const uuid_t& uuid, int halVersi
                     String16(mRequiredPermission));
         }
     }
+#endif
 }
 
 Sensor::~Sensor() {