summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-05-07 18:27:06 -0700
committerMathias Agopian <mathias@google.com>2012-05-07 18:27:06 -0700
commit0b6d77bdeb99ca92709828c7c4867eec2f727f88 (patch)
treede0308e3bc0ed150444171bace879b40f7e41e2d /core/jni
parentff0e8cd8b60aa8372b06edecb2e754b0905c4d31 (diff)
downloadframeworks_base-0b6d77bdeb99ca92709828c7c4867eec2f727f88.zip
frameworks_base-0b6d77bdeb99ca92709828c7c4867eec2f727f88.tar.gz
frameworks_base-0b6d77bdeb99ca92709828c7c4867eec2f727f88.tar.bz2
better error handling in SensorManager
Change-Id: Id0498e950f1407a10e3b2d88e63c2141ac95d103
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android_hardware_SensorManager.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/jni/android_hardware_SensorManager.cpp b/core/jni/android_hardware_SensorManager.cpp
index eddd838..3c1b9c8 100644
--- a/core/jni/android_hardware_SensorManager.cpp
+++ b/core/jni/android_hardware_SensorManager.cpp
@@ -130,10 +130,13 @@ sensors_data_poll(JNIEnv *env, jclass clazz, jint nativeQueue,
res = queue->waitForEvent();
if (res != NO_ERROR)
return -1;
+ // here we're guaranteed to have an event
res = queue->read(&event, 1);
+ ALOGE_IF(res==0, "sensors_data_poll: nothing to read after waitForEvent()");
}
- if (res < 0)
+ if (res <= 0) {
return -1;
+ }
jint accuracy = event.vector.status;
env->SetFloatArrayRegion(values, 0, 3, event.vector.v);