libsensors: Removed the unused sensor status field

Some sensors declare a status field which is actually
not used.
Internally it would be mapped to an accuracy member
that was also not used.

We now get rid of them where needed.
This prepares for the new sensors_data_t structure.

Change-Id: Ic05527abb3177f4e3aebee47488d67ca254e48d1
diff --git a/libsensors/MPLSensor.cpp b/libsensors/MPLSensor.cpp
index a36a565..e766a7f 100644
--- a/libsensors/MPLSensor.cpp
+++ b/libsensors/MPLSensor.cpp
@@ -142,7 +142,7 @@
 
 MPLSensor::MPLSensor() :
     SensorBase(NULL, NULL),
-            mMpuAccuracy(0), mNewData(0),
+            mNewData(0),
             mDmpStarted(false),
             mMasterSensorMask(INV_ALL_SENSORS),
             mLocalSensorMask(ALL_MPL_SENSORS_NP), mPollTime(-1),
@@ -220,30 +220,22 @@
     mPendingEvents[RotationVector].version = sizeof(sensors_event_t);
     mPendingEvents[RotationVector].sensor = ID_RV;
     mPendingEvents[RotationVector].type = SENSOR_TYPE_ROTATION_VECTOR;
-    mPendingEvents[RotationVector].acceleration.status
-            = SENSOR_STATUS_ACCURACY_HIGH;
 
     mPendingEvents[LinearAccel].version = sizeof(sensors_event_t);
     mPendingEvents[LinearAccel].sensor = ID_LA;
     mPendingEvents[LinearAccel].type = SENSOR_TYPE_LINEAR_ACCELERATION;
-    mPendingEvents[LinearAccel].acceleration.status
-            = SENSOR_STATUS_ACCURACY_HIGH;
 
     mPendingEvents[Gravity].version = sizeof(sensors_event_t);
     mPendingEvents[Gravity].sensor = ID_GR;
     mPendingEvents[Gravity].type = SENSOR_TYPE_GRAVITY;
-    mPendingEvents[Gravity].acceleration.status = SENSOR_STATUS_ACCURACY_HIGH;
 
     mPendingEvents[Gyro].version = sizeof(sensors_event_t);
     mPendingEvents[Gyro].sensor = ID_GY;
     mPendingEvents[Gyro].type = SENSOR_TYPE_GYROSCOPE;
-    mPendingEvents[Gyro].gyro.status = SENSOR_STATUS_ACCURACY_HIGH;
 
     mPendingEvents[Accelerometer].version = sizeof(sensors_event_t);
     mPendingEvents[Accelerometer].sensor = ID_A;
     mPendingEvents[Accelerometer].type = SENSOR_TYPE_ACCELEROMETER;
-    mPendingEvents[Accelerometer].acceleration.status
-            = SENSOR_STATUS_ACCURACY_HIGH;
 
     mPendingEvents[MagneticField].version = sizeof(sensors_event_t);
     mPendingEvents[MagneticField].sensor = ID_M;
@@ -508,7 +500,6 @@
         ALOGE("Fatal error: inv_set_fifo_rate returned %d\n", result);
     }
 
-    mMpuAccuracy = SENSOR_STATUS_ACCURACY_MEDIUM;
     setupCallbacks();
 
 }
@@ -578,7 +569,6 @@
     FUNC_LOG;
     //after the first no motion, the gyro should be calibrated well
     if (val == 2) {
-        mMpuAccuracy = SENSOR_STATUS_ACCURACY_HIGH;
         if ((inv_get_dl_config()->requested_sensors) & INV_THREE_AXIS_GYRO) {
             //if gyros are on and we got a no motion, set a flag
             // indicating that the cal file can be written.
@@ -609,7 +599,6 @@
     s->gyro.v[0] = s->gyro.v[0] * M_PI / 180.0;
     s->gyro.v[1] = s->gyro.v[1] * M_PI / 180.0;
     s->gyro.v[2] = s->gyro.v[2] * M_PI / 180.0;
-    s->gyro.status = mMpuAccuracy;
     if (res == INV_SUCCESS)
         *pending_mask |= (1 << index);
 }
@@ -625,7 +614,6 @@
     s->acceleration.v[1] = s->acceleration.v[1] * 9.81;
     s->acceleration.v[2] = s->acceleration.v[2] * 9.81;
     //ALOGV_IF(EXTRA_VERBOSE, "accel data: %f %f %f", s->acceleration.v[0], s->acceleration.v[1], s->acceleration.v[2]);
-    s->acceleration.status = SENSOR_STATUS_ACCURACY_HIGH;
     if (res == INV_SUCCESS)
         *pending_mask |= (1 << index);
 }
@@ -707,9 +695,6 @@
     s->gyro.v[1] = quat[2];
     s->gyro.v[2] = quat[3];
 
-    s->gyro.status
-            = ((mMpuAccuracy < estimateCompassAccuracy()) ? mMpuAccuracy
-                                                            : estimateCompassAccuracy());
 }
 
 void MPLSensor::laHandler(sensors_event_t* s, uint32_t* pending_mask,
@@ -721,7 +706,6 @@
     s->gyro.v[0] *= 9.81;
     s->gyro.v[1] *= 9.81;
     s->gyro.v[2] *= 9.81;
-    s->gyro.status = mMpuAccuracy;
     if (res == INV_SUCCESS)
         *pending_mask |= (1 << index);
 }
@@ -735,7 +719,6 @@
     s->gyro.v[0] *= 9.81;
     s->gyro.v[1] *= 9.81;
     s->gyro.v[2] *= 9.81;
-    s->gyro.status = mMpuAccuracy;
     if (res == INV_SUCCESS)
         *pending_mask |= (1 << index);
 }
@@ -1364,4 +1347,3 @@
     list[Gravity].maxRange = list[Accelerometer].maxRange;
     return;
 }
-
diff --git a/libsensors/MPLSensor.h b/libsensors/MPLSensor.h
index 2b1571d..5b5d121 100644
--- a/libsensors/MPLSensor.h
+++ b/libsensors/MPLSensor.h
@@ -87,7 +87,6 @@
     void calcOrientationSensor(float *Rx, float *Val);
     int estimateCompassAccuracy();
 
-    int mMpuAccuracy; //global storage for the current accuracy status
     int mNewData; //flag indicating that the MPL calculated new output values
     int mDmpStarted;
     long mMasterSensorMask;
diff --git a/libsensors_iio/MPLSensor.cpp b/libsensors_iio/MPLSensor.cpp
index 8cb376c..725a4fc 100644
--- a/libsensors_iio/MPLSensor.cpp
+++ b/libsensors_iio/MPLSensor.cpp
@@ -264,35 +264,26 @@
     mPendingEvents[RotationVector].version = sizeof(sensors_event_t);
     mPendingEvents[RotationVector].sensor = ID_RV;
     mPendingEvents[RotationVector].type = SENSOR_TYPE_ROTATION_VECTOR;
-    mPendingEvents[RotationVector].acceleration.status
-            = SENSOR_STATUS_ACCURACY_HIGH;
 
     mPendingEvents[LinearAccel].version = sizeof(sensors_event_t);
     mPendingEvents[LinearAccel].sensor = ID_LA;
     mPendingEvents[LinearAccel].type = SENSOR_TYPE_LINEAR_ACCELERATION;
-    mPendingEvents[LinearAccel].acceleration.status
-            = SENSOR_STATUS_ACCURACY_HIGH;
 
     mPendingEvents[Gravity].version = sizeof(sensors_event_t);
     mPendingEvents[Gravity].sensor = ID_GR;
     mPendingEvents[Gravity].type = SENSOR_TYPE_GRAVITY;
-    mPendingEvents[Gravity].acceleration.status = SENSOR_STATUS_ACCURACY_HIGH;
 
     mPendingEvents[Gyro].version = sizeof(sensors_event_t);
     mPendingEvents[Gyro].sensor = ID_GY;
     mPendingEvents[Gyro].type = SENSOR_TYPE_GYROSCOPE;
-    mPendingEvents[Gyro].gyro.status = SENSOR_STATUS_ACCURACY_HIGH;
 
     mPendingEvents[RawGyro].version = sizeof(sensors_event_t);
     mPendingEvents[RawGyro].sensor = ID_RG;
     mPendingEvents[RawGyro].type = SENSOR_TYPE_GYROSCOPE;
-    mPendingEvents[RawGyro].gyro.status = SENSOR_STATUS_ACCURACY_HIGH;
 
     mPendingEvents[Accelerometer].version = sizeof(sensors_event_t);
     mPendingEvents[Accelerometer].sensor = ID_A;
     mPendingEvents[Accelerometer].type = SENSOR_TYPE_ACCELEROMETER;
-    mPendingEvents[Accelerometer].acceleration.status
-            = SENSOR_STATUS_ACCURACY_HIGH;
 
     /* Invensense compass calibration */
     mPendingEvents[MagneticField].version = sizeof(sensors_event_t);
@@ -1208,8 +1199,9 @@
 int MPLSensor::gyroHandler(sensors_event_t* s)
 {
     VHANDLER_LOG;
+    int8_t status;
     int update;
-    update = inv_get_sensor_type_gyroscope(s->gyro.v, &s->gyro.status, &s->timestamp);
+    update = inv_get_sensor_type_gyroscope(s->gyro.v, &status, &s->timestamp);
     LOGV_IF(HANDLER_DATA, "HAL:gyro data : %+f %+f %+f -- %lld - %d",
             s->gyro.v[0], s->gyro.v[1], s->gyro.v[2], s->timestamp, update);
     return update;
@@ -1218,8 +1210,9 @@
 int MPLSensor::rawGyroHandler(sensors_event_t* s)
 {
     VHANDLER_LOG;
+    int8_t status;
     int update;
-    update = inv_get_sensor_type_gyroscope_raw(s->gyro.v, &s->gyro.status, &s->timestamp);
+    update = inv_get_sensor_type_gyroscope_raw(s->gyro.v, &status, &s->timestamp);
     LOGV_IF(HANDLER_DATA, "HAL:raw gyro data : %+f %+f %+f -- %lld - %d",
             s->gyro.v[0], s->gyro.v[1], s->gyro.v[2], s->timestamp, update);
     return update;
@@ -1228,13 +1221,14 @@
 int MPLSensor::accelHandler(sensors_event_t* s)
 {
     VHANDLER_LOG;
+    int8_t status;
     int update;
     update = inv_get_sensor_type_accelerometer(
-        s->acceleration.v, &s->acceleration.status, &s->timestamp);
+        s->acceleration.v, &status, &s->timestamp);
     LOGV_IF(HANDLER_DATA, "HAL:accel data : %+f %+f %+f -- %lld - %d",
             s->acceleration.v[0], s->acceleration.v[1], s->acceleration.v[2],
             s->timestamp, update);
-    mAccelAccuracy = s->acceleration.status;
+    mAccelAccuracy = status;
     return update;
 }
 
@@ -1265,9 +1259,10 @@
 int MPLSensor::laHandler(sensors_event_t* s)
 {
     VHANDLER_LOG;
+    int8_t status;
     int update;
     update = inv_get_sensor_type_linear_acceleration(
-            s->gyro.v, &s->gyro.status, &s->timestamp);
+            s->gyro.v, &status, &s->timestamp);
     LOGV_IF(HANDLER_DATA, "HAL:la data: %+f %+f %+f - %lld - %d",
             s->gyro.v[0], s->gyro.v[1], s->gyro.v[2], s->timestamp, update);
     return update;
@@ -1276,8 +1271,9 @@
 int MPLSensor::gravHandler(sensors_event_t* s)
 {
     VHANDLER_LOG;
+    int8_t status;
     int update;
-    update = inv_get_sensor_type_gravity(s->gyro.v, &s->gyro.status, &s->timestamp);
+    update = inv_get_sensor_type_gravity(s->gyro.v, &status, &s->timestamp);
     LOGV_IF(HANDLER_DATA, "HAL:gr data: %+f %+f %+f - %lld - %d",
             s->gyro.v[0], s->gyro.v[1], s->gyro.v[2], s->timestamp, update);
     return update;