Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Apply bitmask to determine if ADR is valid #29

Merged
merged 1 commit into from
Feb 23, 2021

Conversation

barbeau
Copy link
Contributor

@barbeau barbeau commented Feb 22, 2021

GnssLogger currently uses a test of equality to 1 (GnssMeasurement.ADR_STATE_VALID) for GnssMeasurement.getAccumulatedDeltaRangeState() to determine if the ADR is valid for a particular measurement.

This no longer works with newer devices >= API 28, as the ADR is now a bitmask of the various constants listed at:
https://developer.android.com/reference/android/location/GnssMeasurement#constants_1

For example, the ADR state can be both ADR_STATE_HALF_CYCLE_RESOLVED logical OR'd with ADR_STATE_VALID, with gives you 1001 in binary or 9 in decimal. So this is a valid ADR state, but is not equal to 1.

You can see these valid ADR state values that aren't equal to 1 in the data from the Google "Smartphone Decimeter Challenge" here:
https://www.kaggle.com/google/android-smartphones-high-accuracy-datasets

This PR changes the GnssLogger code to correctly apply the bitmask to the GnssMeasurement.getAccumulatedDeltaRangeState() value to determine if it is a valid ADR state.

It also substitutes a check for an unknown ADR state by using the constant GnssMeasurement.ADR_STATE_UNKNOWN instead of just 0. Note that Lint incorrectly flags the use of this constant currently as an error - I've opened an issue on the Google issue tracker here about this:
https://issuetracker.google.com/issues/174553586

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants