am 4a605883: (-s ours) am d411d613: Merge "65xx: Minimally refactor Android.mk"

* commit '4a6058838e80addbeddb64f662b947291f1481c9':
diff --git a/6515/libsensors_iio/InputEventReader.cpp b/6515/libsensors_iio/InputEventReader.cpp
index 968e32e..5ec3e6c 100755
--- a/6515/libsensors_iio/InputEventReader.cpp
+++ b/6515/libsensors_iio/InputEventReader.cpp
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <poll.h>
+#include <string.h>
 
 #include <sys/cdefs.h>
 #include <sys/types.h>
diff --git a/6515/libsensors_iio/MPLSensor.cpp b/6515/libsensors_iio/MPLSensor.cpp
index ad6d4e9..0ef2c95 100644
--- a/6515/libsensors_iio/MPLSensor.cpp
+++ b/6515/libsensors_iio/MPLSensor.cpp
@@ -117,20 +117,6 @@
                          mAccelBiasApplied(false),
                          mPendingMask(0),
                          mSensorMask(0),
-                         mMplFeatureActiveMask(0),
-                         mFeatureActiveMask(0),
-                         mDmpOn(0),
-                         mPedUpdate(0),
-                         mPressureUpdate(0),
-                         mQuatSensorTimestamp(0),
-                         mStepSensorTimestamp(0),
-                         mLastStepCount(-1),
-                         mLeftOverBufferSize(0),
-                         mInitial6QuatValueAvailable(0),
-                         mFlushBatchSet(0),
-                         mSkipReadEvents(0),
-                         mDataMarkerDetected(0),
-                         mEmptyDataMarkerDetected(0),
                          mGyroBatchRate(0),
                          mAccelBatchRate(0),
                          mCompassBatchRate(0),
@@ -144,7 +130,20 @@
                          mResetRate(0),
                          mDataInterrupt(0),
                          mFirstBatchCall(1),
-                         mEnableCalled(1) {
+                         mEnableCalled(1),
+                         mMplFeatureActiveMask(0),
+                         mFeatureActiveMask(0),
+                         mDmpOn(0),
+                         mPedUpdate(0),
+                         mPressureUpdate(0),
+                         mQuatSensorTimestamp(0),
+                         mStepSensorTimestamp(0),
+                         mLastStepCount(-1),
+                         mLeftOverBufferSize(0),
+                         mInitial6QuatValueAvailable(0),
+                         mSkipReadEvents(0),
+                         mDataMarkerDetected(0),
+                         mEmptyDataMarkerDetected(0) {
     VFUNC_LOG;
 
     inv_error_t rv;
@@ -1822,7 +1821,7 @@
             mFeatureActiveMask |= INV_DMP_PEDOMETER_STEP;
         }
 
-        clock_gettime(CLOCK_MONOTONIC, &mt_pre);
+        clock_gettime(CLOCK_BOOTTIME, &mt_pre);
     } else {
         if (interruptMode) {
             mFeatureActiveMask &= ~INV_DMP_PEDOMETER;
@@ -2827,7 +2826,7 @@
 
     /* Capture timestamp in HAL */
     struct timespec ts;
-    clock_gettime(CLOCK_MONOTONIC, &ts);
+    clock_gettime(CLOCK_BOOTTIME, &ts);
     s->timestamp = (int64_t) ts.tv_sec * 1000000000 + ts.tv_nsec;
 
     LOGV_IF(HANDLER_DATA, "HAL:sm data: %f - %lld - %d",
@@ -2886,7 +2885,7 @@
 
     /* get current timestamp */
     struct timespec ts;
-    clock_gettime(CLOCK_MONOTONIC, &ts) ;
+    clock_gettime(CLOCK_BOOTTIME, &ts) ;
     s->timestamp = (int64_t)ts.tv_sec * 1000000000 + ts.tv_nsec;
 
     LOGV_IF(HANDLER_DATA, "HAL:sd data: %f - %lld - %d",
@@ -2912,7 +2911,7 @@
 
     if (s->timestamp == 0 && update) {
         struct timespec ts;
-        clock_gettime(CLOCK_MONOTONIC, &ts);
+        clock_gettime(CLOCK_BOOTTIME, &ts);
         s->timestamp = (int64_t) ts.tv_sec * 1000000000 + ts.tv_nsec;
                 // workaround for some platform which has gap between monotonic clock
                 // and Android SystemClock.
@@ -4695,7 +4694,7 @@
         temp.screen_orientation = screen_orientation;
 #endif
         struct timespec ts;
-        clock_gettime(CLOCK_MONOTONIC, &ts);
+        clock_gettime(CLOCK_BOOTTIME, &ts);
         temp.timestamp = (int64_t) ts.tv_sec * 1000000000 + ts.tv_nsec;
 
         *data++ = temp;
@@ -4767,7 +4766,7 @@
         struct timespec t_now;
         int64_t interval = 0;
 
-        clock_gettime(CLOCK_MONOTONIC, &t_now);
+        clock_gettime(CLOCK_BOOTTIME, &t_now);
         interval = ((int64_t(t_now.tv_sec) * 1000000000LL + t_now.tv_nsec) -
                     (int64_t(mt_pre.tv_sec) * 1000000000LL + mt_pre.tv_nsec));
 
@@ -4777,7 +4776,7 @@
                     interval, mStepCountPollTime);
             return false;
         } else {
-            clock_gettime(CLOCK_MONOTONIC, &mt_pre);
+            clock_gettime(CLOCK_BOOTTIME, &mt_pre);
             LOGV_IF(0, "Step Count previous time: %ld ms",
                     mt_pre.tv_nsec / 1000);
             return true;
@@ -5224,6 +5223,7 @@
 
     // get proper (in absolute) IIO path & build MPU's sysfs paths
     inv_get_sysfs_path(sysfs_path);
+    LOGV_IF(true, "njv Invensense sysfs path : %s", sysfs_path);
 
     memcpy(mSysfsPath, sysfs_path, sizeof(sysfs_path));
     sprintf(mpu.key, "%s%s", sysfs_path, "/key");
@@ -5759,7 +5759,11 @@
 
     LOGV_IF(PROCESS_VERBOSE,
             "HAL:batch after applying upper and lower limit: %llu ns, (%.2f Hz)",
-			period_ns, 1000000000.f / period_ns);
+            period_ns, 1000000000.f / period_ns);
+
+    LOGV_IF(PROCESS_VERBOSE,
+            "HAL:batch after applying upper and lower limit: %llu ns, (%.2f Hz)",
+            period_ns, 1000000000.f / period_ns);
 
     switch (what) {
     case Gyro:
@@ -6543,7 +6547,7 @@
 #ifdef ENABLE_PRESSURE
     int64_t pressureRate;
 #endif
-    int64_t quatRate;
+    int64_t quatRate = 0;
 
     int mplGyroRate;
     int mplAccelRate;
diff --git a/6515/libsensors_iio/SensorBase.cpp b/6515/libsensors_iio/SensorBase.cpp
index 544ac15..16057ff 100755
--- a/6515/libsensors_iio/SensorBase.cpp
+++ b/6515/libsensors_iio/SensorBase.cpp
@@ -24,6 +24,7 @@
 #include <sys/select.h>
 #include <cutils/log.h>
 #include <linux/input.h>
+#include <string.h>
 
 #include <cutils/properties.h>
 
@@ -143,7 +144,7 @@
 {
     struct timespec t;
     t.tv_sec = t.tv_nsec = 0;
-    clock_gettime(CLOCK_MONOTONIC, &t);
+    clock_gettime(CLOCK_BOOTTIME, &t);
     return int64_t(t.tv_sec) * 1000000000LL + t.tv_nsec;
 }
 
diff --git a/6515/libsensors_iio/sensors_mpl.cpp b/6515/libsensors_iio/sensors_mpl.cpp
index 7e7b06b..c55e86c 100755
--- a/6515/libsensors_iio/sensors_mpl.cpp
+++ b/6515/libsensors_iio/sensors_mpl.cpp
@@ -81,6 +81,14 @@
         open: open_sensors
 };
 
+static int sensors_set_operation_mode(unsigned int mode)
+{
+    LOGI("%s", __FUNCTION__);
+    LOGI("%s: stub function: ignoring mode request (%d)", __FUNCTION__,
+                 mode);
+    return 0;
+}
+
 struct sensors_module_t HAL_MODULE_INFO_SYM = {
         common: {
                 tag: HARDWARE_MODULE_TAG,
@@ -94,6 +102,7 @@
                 reserved: {0}
         },
         get_sensors_list: sensors__get_sensors_list,
+        set_operation_mode: sensors_set_operation_mode
 };
 
 struct sensors_poll_context_t {