diff options
author | 2021-05-07 21:21:31 -0700 | |
---|---|---|
committer | 2023-07-20 18:06:40 +0000 | |
commit | 24f862dd5c645e203bc64531d5ec31db8b4acc1b (patch) | |
tree | e62591f008ed779341acf4ff4f7d72af974730b7 | |
parent | 65bbffc12a61a9a76987ddcc901166ecbedf0e9f (diff) |
SensorFusion: don't use wake sensors for fusion
- Avoid using wake sensors for fusion as the fused
sensor isn't wake up and it causes a lot of load
on the system to keep wake locks.
Bug: 270230642
Bug: 290816762
Test: local build and using maps app
Change-Id: I17159f55f0d32bda3c15b56412b6d93808e1c436
(cherry picked from commit 8af03c922eb53fc3d8711cb304bb0b128f6d48ae)
(cherry picked from commit fc6db32061be72c9dc95c293ac1e07c96ea62e18)
-rw-r--r-- | services/sensorservice/SensorFusion.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/services/sensorservice/SensorFusion.cpp b/services/sensorservice/SensorFusion.cpp index e27b52b23e..c3f38d9838 100644 --- a/services/sensorservice/SensorFusion.cpp +++ b/services/sensorservice/SensorFusion.cpp @@ -41,17 +41,20 @@ SensorFusion::SensorFusion() if (count > 0) { for (size_t i=0 ; i<size_t(count) ; i++) { - if (list[i].type == SENSOR_TYPE_ACCELEROMETER) { - mAcc = Sensor(list + i); - } - if (list[i].type == SENSOR_TYPE_MAGNETIC_FIELD) { - mMag = Sensor(list + i); - } - if (list[i].type == SENSOR_TYPE_GYROSCOPE) { - mGyro = Sensor(list + i); - } - if (list[i].type == SENSOR_TYPE_GYROSCOPE_UNCALIBRATED) { - uncalibratedGyro = Sensor(list + i); + // Only use non-wakeup sensors + if ((list[i].flags & SENSOR_FLAG_WAKE_UP) == 0) { + if (list[i].type == SENSOR_TYPE_ACCELEROMETER) { + mAcc = Sensor(list + i); + } + if (list[i].type == SENSOR_TYPE_MAGNETIC_FIELD) { + mMag = Sensor(list + i); + } + if (list[i].type == SENSOR_TYPE_GYROSCOPE) { + mGyro = Sensor(list + i); + } + if (list[i].type == SENSOR_TYPE_GYROSCOPE_UNCALIBRATED) { + uncalibratedGyro = Sensor(list + i); + } } } |