Fix sockfd leakage in SensorService. Remove sockfd from Looper

when the connection is removed from mActiveConnections.

Bug: 17472228
Change-Id: Iaabe0968bd2104ef961ff5e8659bf91712e2e1db
This commit is contained in:
Aravind Akella 2014-09-23 16:42:49 -07:00
parent 12c4bdad7b
commit 5105960d49
1 changed files with 2 additions and 0 deletions

View File

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