diff options
author | Mathias Agopian <mathias@google.com> | 2010-09-16 17:04:16 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-09-16 17:33:48 -0700 |
commit | 4d3cb63b9b9177b79c575ca1b21040cc42ee7879 (patch) | |
tree | d7d00b7efd84dc9b8dcc359f038c734a216f31d9 /core/java/android/hardware/SensorManager.java | |
parent | ec33b82c42f3dd996a72b80359c87524b51ffb2a (diff) | |
download | frameworks_base-4d3cb63b9b9177b79c575ca1b21040cc42ee7879.zip frameworks_base-4d3cb63b9b9177b79c575ca1b21040cc42ee7879.tar.gz frameworks_base-4d3cb63b9b9177b79c575ca1b21040cc42ee7879.tar.bz2 |
part of fix for [3004226] Cannot end the call - Proximity sensor doesn't work
- In SensorEventQueue, only bail on errors from Looper::loopOnce
- Improve sensor error logging
Change-Id: Ib3cf8d5d9fdac8513a3d753155827e0feeda1662
Diffstat (limited to 'core/java/android/hardware/SensorManager.java')
-rw-r--r-- | core/java/android/hardware/SensorManager.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java index 76ce2f8..a271075 100644 --- a/core/java/android/hardware/SensorManager.java +++ b/core/java/android/hardware/SensorManager.java @@ -447,12 +447,12 @@ public class SensorManager int accuracy = status[0]; synchronized (sListeners) { 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 lost the connection to the event stream. this happens + // when the last listener is removed or if there is an error + if (sensor == -1 && !sListeners.isEmpty()) { + // log a warning in case of abnormal termination + Log.e(TAG, "_sensors_data_poll() failed, we bail out: sensors=" + sensor); } - // we have no more listeners or polling failed, terminate the thread sensors_destroy_queue(sQueue); sQueue = 0; @@ -1101,6 +1101,7 @@ public class SensorManager if (listener == null || sensor == null) { return; } + synchronized (sListeners) { final int size = sListeners.size(); for (int i=0 ; i<size ; i++) { @@ -1122,6 +1123,7 @@ public class SensorManager if (listener == null) { return; } + synchronized (sListeners) { final int size = sListeners.size(); for (int i=0 ; i<size ; i++) { |