diff options
author | Mathias Agopian <mathias@google.com> | 2011-02-03 15:38:15 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-03 15:38:15 -0800 |
commit | 33e9cb47d286276ed2542d3059db72d2c5a9b7ff (patch) | |
tree | d10ce80b4fb2f6d34a524a57e19dfdff53f569ee /services | |
parent | 60a008ed834da2b9eb6968cfb05733860aaa51b5 (diff) | |
parent | f0aec213ec02fb833f3c927206dad9693e0672de (diff) | |
download | frameworks_base-33e9cb47d286276ed2542d3059db72d2c5a9b7ff.zip frameworks_base-33e9cb47d286276ed2542d3059db72d2c5a9b7ff.tar.gz frameworks_base-33e9cb47d286276ed2542d3059db72d2c5a9b7ff.tar.bz2 |
Merge "fix [3421350] Killing a game that uses the accelerometer renders the device unable to sleep" into honeycomb
Diffstat (limited to 'services')
-rw-r--r-- | services/sensorservice/SensorService.cpp | 13 | ||||
-rw-r--r-- | services/sensorservice/SensorService.h | 2 |
2 files changed, 9 insertions, 6 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; diff --git a/services/sensorservice/SensorService.h b/services/sensorservice/SensorService.h index 540c7e2..21f12bd 100644 --- a/services/sensorservice/SensorService.h +++ b/services/sensorservice/SensorService.h @@ -129,7 +129,7 @@ class SensorService : public: static char const* getServiceName() { return "sensorservice"; } - void cleanupConnection(const wp<SensorEventConnection>& connection); + void cleanupConnection(SensorEventConnection* connection); status_t enable(const sp<SensorEventConnection>& connection, int handle); status_t disable(const sp<SensorEventConnection>& connection, int handle); status_t setEventRate(const sp<SensorEventConnection>& connection, int handle, nsecs_t ns); |