summaryrefslogtreecommitdiffstats
path: root/services/sensorservice/SensorService.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-02-03 14:52:47 -0800
committerMathias Agopian <mathias@google.com>2012-06-27 17:07:54 -0700
commitdb5b4bce9e65ec9c2c7762b601297e4abadbc22a (patch)
tree13d7fa9b4e86d227b3e4c6d1bbf88ba0554f530e /services/sensorservice/SensorService.cpp
parent2cf098846c83bab82272f107ba110f7c47df1763 (diff)
downloadframeworks_native-db5b4bce9e65ec9c2c7762b601297e4abadbc22a.zip
frameworks_native-db5b4bce9e65ec9c2c7762b601297e4abadbc22a.tar.gz
frameworks_native-db5b4bce9e65ec9c2c7762b601297e4abadbc22a.tar.bz2
fix [3421350] Killing a game that uses the accelerometer renders the device unable to sleep
when an app dies, make sure to disable all sensors that process is connected to, regardless of wether this was the LAST connection to this sensor. Change-Id: I9c72b1792eee03815304674d5c2f25b5270e4748
Diffstat (limited to 'services/sensorservice/SensorService.cpp')
-rw-r--r--services/sensorservice/SensorService.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index ea5e5cc..697e879 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -293,18 +293,21 @@ sp<ISensorEventConnection> SensorService::createSensorEventConnection()
return result;
}
-void SensorService::cleanupConnection(const wp<SensorEventConnection>& connection)
+void SensorService::cleanupConnection(SensorEventConnection* c)
{
Mutex::Autolock _l(mLock);
+ const wp<SensorEventConnection> connection(c);
size_t size = mActiveSensors.size();
for (size_t i=0 ; i<size ; ) {
- SensorRecord* rec = mActiveSensors.valueAt(i);
- if (rec && rec->removeConnection(connection)) {
- int handle = mActiveSensors.keyAt(i);
+ int handle = mActiveSensors.keyAt(i);
+ if (c->hasSensor(handle)) {
SensorInterface* sensor = mSensorMap.valueFor( handle );
if (sensor) {
- sensor->activate(connection.unsafe_get(), false);
+ sensor->activate(c, false);
}
+ }
+ SensorRecord* rec = mActiveSensors.valueAt(i);
+ if (rec && rec->removeConnection(connection)) {
mActiveSensors.removeItemsAt(i, 1);
mActiveVirtualSensors.removeItem(handle);
delete rec;