am 5105960d: Fix sockfd leakage in SensorService. Remove sockfd from Looper when the connection is removed from mActiveConnections.

* commit '5105960d49bfa86efeeea8f87c87aa96b5771c37':
  Fix sockfd leakage in SensorService. Remove sockfd from Looper when the connection is removed from mActiveConnections.
This commit is contained in:
Aravind Akella 2014-09-24 04:24:07 +00:00 committed by Android Git Automerger
commit 8f12365b76

View File

@ -653,6 +653,7 @@ void SensorService::cleanupConnection(SensorEventConnection* c)
i++; i++;
} }
} }
mLooper->removeFd(c->getSensorChannel()->getSendFd());
mActiveConnections.remove(connection); mActiveConnections.remove(connection);
BatteryService::cleanup(c->getUid()); BatteryService::cleanup(c->getUid());
if (c->needsWakeLock()) { if (c->needsWakeLock()) {
@ -799,6 +800,7 @@ status_t SensorService::cleanupWithoutDisableLocked(
BatteryService::disableSensor(connection->getUid(), handle); BatteryService::disableSensor(connection->getUid(), handle);
} }
if (connection->hasAnySensor() == false) { if (connection->hasAnySensor() == false) {
mLooper->removeFd(connection->getSensorChannel()->getSendFd());
mActiveConnections.remove(connection); mActiveConnections.remove(connection);
} }
// see if this sensor becomes inactive // see if this sensor becomes inactive