diff options
author | Mathias Agopian <mathias@google.com> | 2012-05-07 18:27:06 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2012-05-07 18:27:06 -0700 |
commit | 0b6d77bdeb99ca92709828c7c4867eec2f727f88 (patch) | |
tree | de0308e3bc0ed150444171bace879b40f7e41e2d /core/jni | |
parent | ff0e8cd8b60aa8372b06edecb2e754b0905c4d31 (diff) | |
download | frameworks_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.cpp | 5 |
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); |