Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b6d77bd authored by Mathias Agopian's avatar Mathias Agopian
Browse files

better error handling in SensorManager

Change-Id: Id0498e950f1407a10e3b2d88e63c2141ac95d103
parent ff0e8cd8
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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);