diff options
Diffstat (limited to 'services/sensorservice/SensorService.cpp')
-rw-r--r-- | services/sensorservice/SensorService.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index c5e69ff..f1db2f5 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -297,16 +297,25 @@ void SensorService::cleanupConnection(SensorEventConnection* c) Mutex::Autolock _l(mLock); const wp<SensorEventConnection> connection(c); size_t size = mActiveSensors.size(); + LOGD_IF(DEBUG_CONNECTIONS, "%d active sensors", size); for (size_t i=0 ; i<size ; ) { int handle = mActiveSensors.keyAt(i); if (c->hasSensor(handle)) { + LOGD_IF(DEBUG_CONNECTIONS, "%i: disabling handle=0x%08x", i, handle); SensorInterface* sensor = mSensorMap.valueFor( handle ); + LOGE_IF(!sensor, "mSensorMap[handle=0x%08x] is null!", handle); if (sensor) { sensor->activate(c, false); } } SensorRecord* rec = mActiveSensors.valueAt(i); + LOGE_IF(!rec, "mActiveSensors[%d] is null (handle=0x%08x)!", i, handle); + LOGD_IF(DEBUG_CONNECTIONS, + "removing connection %p for sensor[%d].handle=0x%08x", + c, i, handle); + if (rec && rec->removeConnection(connection)) { + LOGD_IF(DEBUG_CONNECTIONS, "... and it was the last connection"); mActiveSensors.removeItemsAt(i, 1); mActiveVirtualSensors.removeItem(handle); delete rec; @@ -446,6 +455,7 @@ SensorService::SensorEventConnection::SensorEventConnection( SensorService::SensorEventConnection::~SensorEventConnection() { + LOGD_IF(DEBUG_CONNECTIONS, "~SensorEventConnection(%p)", this); mService->cleanupConnection(this); } |