diff options
author | Andreas Huber <> | 2009-03-25 17:54:39 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-25 17:54:39 -0700 |
commit | 6dee6243bf5ecb96291e62ece7d736c5aee1e505 (patch) | |
tree | bce31d903a514f67dcea4e165353d3916f1e00dc | |
parent | 986003d46add147714ce7e16c9fefa8c18042fc8 (diff) | |
download | frameworks_base-6dee6243bf5ecb96291e62ece7d736c5aee1e505.zip frameworks_base-6dee6243bf5ecb96291e62ece7d736c5aee1e505.tar.gz frameworks_base-6dee6243bf5ecb96291e62ece7d736c5aee1e505.tar.bz2 |
Automated import from //branches/donutburger/...@142801,142801
-rw-r--r-- | core/java/android/hardware/SensorManager.java | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java index e232c2c..7fbb3a7 100644 --- a/core/java/android/hardware/SensorManager.java +++ b/core/java/android/hardware/SensorManager.java @@ -304,6 +304,9 @@ public class SensorManager extends IRotationWatcher.Stub if (mSensorDataFd == null) { Log.e(TAG, "mSensorDataFd == NULL, exiting"); + synchronized (sListeners) { + mThread = null; + } return; } // this thread is guaranteed to be unique @@ -321,17 +324,16 @@ public class SensorManager extends IRotationWatcher.Stub // wait for an event final int sensor = sensors_data_poll(values, status, timestamp); - if (sensor == -1) { - // we lost the connection to the event stream. this happens - // when the last listener is removed. - Log.d(TAG, "_sensors_data_poll() failed, we bail out."); - break; - } - int accuracy = status[0]; synchronized (sListeners) { - if (sListeners.isEmpty()) { - // we have no more listeners, terminate the thread + if (sensor == -1 || sListeners.isEmpty()) { + if (sensor == -1) { + // we lost the connection to the event stream. this happens + // when the last listener is removed. + Log.d(TAG, "_sensors_data_poll() failed, we bail out."); + } + + // we have no more listeners or polling failed, terminate the thread sensors_data_close(); mThread = null; break; |