From f8a6737f3d812b6b151990ad1695b55bfb0d8dda Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 8 Jun 2011 20:06:50 -0700 Subject: [PATCH] improve orientation sensor with gyro data when we do our own sensor fusion, we also export an improved orientation sensor and hide the HAL sensor. The fused orientation sensor is much more precise, fast and smooth. Change-Id: I0ea843b47ad9d12f6b22cce51f8629852d423126 --- services/sensorservice/SensorService.cpp | 23 +++++++++++++++++++---- services/sensorservice/SensorService.h | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index d1b10f799c1b0..0ae79294f9a7f 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -52,7 +52,6 @@ namespace android { * Notes: * * - what about a gyro-corrected magnetic-field sensor? - * - option to "hide" the HAL sensors * - run mag sensor from time to time to force calibration * - gravity sensor length is wrong (=> drift in linear-acc sensor) * @@ -71,6 +70,7 @@ void SensorService::onFirstRef() SensorDevice& dev(SensorDevice::getInstance()); if (dev.initCheck() == NO_ERROR) { + ssize_t orientationIndex = -1; bool hasGyro = false; uint32_t virtualSensorsNeeds = (1<= 0) { + mUserSensorList.removeItemsAt(orientationIndex); + } + } + run("SensorService", PRIORITY_URGENT_DISPLAY); mInitCheck = NO_ERROR; } @@ -315,9 +330,9 @@ SensorService::getActiveVirtualSensors() const } String8 SensorService::getSensorName(int handle) const { - size_t count = mSensorList.size(); + size_t count = mUserSensorList.size(); for (size_t i=0 ; i SensorService::getSensorList() { - return mSensorList; + return mUserSensorList; } sp SensorService::createSensorEventConnection() diff --git a/services/sensorservice/SensorService.h b/services/sensorservice/SensorService.h index 77a7e34e85109..4d0f1d9d9c5d2 100644 --- a/services/sensorservice/SensorService.h +++ b/services/sensorservice/SensorService.h @@ -114,6 +114,7 @@ class SensorService : // constants Vector mSensorList; + Vector mUserSensorList; DefaultKeyedVector mSensorMap; Vector mVirtualSensorList; Permission mDump;