From cf6b4d32e45694df60a7ffa5beac70e0be5a7902 Mon Sep 17 00:00:00 2001 From: gomo Date: Sun, 15 Jan 2017 20:08:59 -0800 Subject: [PATCH] Unset Vertical Accuracy, Speed Accruacy and Bearing Accuracy fields as some chipsets set them in pre-Android-O devices. Test: Existing unit tests still pass. Change-Id: I542a2d82d16c1017859ad08060f30a0187664ffd --- gnss/1.0/default/GnssUtils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gnss/1.0/default/GnssUtils.cpp b/gnss/1.0/default/GnssUtils.cpp index 4b3ca440fb..82a516bc01 100644 --- a/gnss/1.0/default/GnssUtils.cpp +++ b/gnss/1.0/default/GnssUtils.cpp @@ -28,7 +28,10 @@ GnssLocation convertToGnssLocation(GpsLocation* location) { GnssLocation gnssLocation = {}; if (location != nullptr) { gnssLocation = { - .gnssLocationFlags = location->flags, + // Bit operation AND with 1f below is needed to clear vertical accuracy, + // speed accuracy and bearing accuracy flags as some vendors are found + // to be setting these bits in pre-Android-O devices + .gnssLocationFlags = static_cast(location->flags & 0x1f), .latitudeDegrees = location->latitude, .longitudeDegrees = location->longitude, .altitudeMeters = location->altitude,