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

Commit bd5e966f authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Don't quantize max range with a resolution of 0" am: 209c251c am: 968386fa

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1444139

Change-Id: I5e3f4cce69d0e40eca79d9a2421e8f7e6993d9ab
parents bf6faacc 968386fa
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -153,12 +153,18 @@ void SensorDevice::initializeSensorList() {
                                    SensorDeviceUtils::defaultResolutionForType(sensor.type);
                        }

                        // Some sensors don't have a default resolution and will be left at 0.
                        // Don't crash in this case since CTS will verify that devices don't go to
                        // production with a resolution of 0.
                        if (sensor.resolution != 0) {
                            double promotedResolution = sensor.resolution;
                            double promotedMaxRange = sensor.maxRange;
                            if (fmod(promotedMaxRange, promotedResolution) != 0) {
                                ALOGW("%s's max range %f is not a multiple of the resolution %f",
                                        sensor.name, sensor.maxRange, sensor.resolution);
                            SensorDeviceUtils::quantizeValue(&sensor.maxRange, promotedResolution);
                                SensorDeviceUtils::quantizeValue(
                                        &sensor.maxRange, promotedResolution);
                            }
                        }
                    }