From b483d5cd134cda393824fd8e9c1a5443bd868ae6 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 29 Nov 2010 17:26:51 -0800 Subject: fix [3237242] sensormanager sensor active count gets out of sync whether a physical sensor needed to be active or not was managed by a simpe reference counter; unfortunatelly nothing prevented it to get out of sync if a sensor was disabled more than once. sensorservice already maintainted a list of all the "clients" connected to a physical sensor; we now use that list to determine if a sensor should be enabled. This can never be "out-of-sync" since this is the only data structure linking a sensor to a user of that sensor. also removed the isEnabled() method, which was never used and implemented wrongly (since it didn't take into account that a sensor could be disabled for a client but not of another). Change-Id: I789affb877728ca957e99f7ba749def37c4db1c7 --- services/sensorservice/SensorDevice.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'services/sensorservice/SensorDevice.cpp') diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp index 73f85ba..f192913 100644 --- a/services/sensorservice/SensorDevice.cpp +++ b/services/sensorservice/SensorDevice.cpp @@ -137,9 +137,8 @@ void SensorDevice::dump(String8& result, char* buffer, size_t SIZE) Mutex::Autolock _l(mLock); for (size_t i=0 ; i= 0) { + if (info.rates.size() == 0) { + actuateHardware = true; + } + } else { + // sensor wasn't enabled for this ident + } } + if (actuateHardware) { err = mSensorDevice->activate(mSensorDevice, handle, enabled); if (enabled) { -- cgit v1.1