diff --git a/api/system-current.txt b/api/system-current.txt index b188d76ecf9a6..975e30071f4c9 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -3056,81 +3056,75 @@ package android.location { public final class GnssMeasurementCorrections implements android.os.Parcelable { method public int describeContents(); - method public double getAltitudeMeters(); - method public double getHorizontalPositionUncertaintyMeters(); - method public double getLatitudeDegrees(); - method public double getLongitudeDegrees(); - method @Nullable public java.util.List getSingleSatelliteCorrectionList(); - method public long getToaGpsNanosecondsOfWeek(); - method public double getVerticalPositionUncertaintyMeters(); - method public void writeToParcel(android.os.Parcel, int); - field @NonNull public static final android.os.Parcelable.Creator CREATOR; + method @FloatRange(from=-1000.0F, to=10000.0f) public double getAltitudeMeters(); + method @FloatRange(from=0.0f) public double getHorizontalPositionUncertaintyMeters(); + method @FloatRange(from=-90.0F, to=90.0f) public double getLatitudeDegrees(); + method @FloatRange(from=-180.0F, to=180.0f) public double getLongitudeDegrees(); + method @NonNull public java.util.List getSingleSatelliteCorrectionList(); + method @IntRange(from=0) public long getToaGpsNanosecondsOfWeek(); + method @FloatRange(from=0.0f) public double getVerticalPositionUncertaintyMeters(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; } public static final class GnssMeasurementCorrections.Builder { ctor public GnssMeasurementCorrections.Builder(); - method public android.location.GnssMeasurementCorrections build(); - method public android.location.GnssMeasurementCorrections.Builder setAltitudeMeters(double); - method public android.location.GnssMeasurementCorrections.Builder setHorizontalPositionUncertaintyMeters(double); - method public android.location.GnssMeasurementCorrections.Builder setLatitudeDegrees(double); - method public android.location.GnssMeasurementCorrections.Builder setLongitudeDegrees(double); - method public android.location.GnssMeasurementCorrections.Builder setSingleSatelliteCorrectionList(@Nullable java.util.List); - method public android.location.GnssMeasurementCorrections.Builder setToaGpsNanosecondsOfWeek(long); - method public android.location.GnssMeasurementCorrections.Builder setVerticalPositionUncertaintyMeters(double); + method @NonNull public android.location.GnssMeasurementCorrections build(); + method @NonNull public android.location.GnssMeasurementCorrections.Builder setAltitudeMeters(@FloatRange(from=-1000.0F, to=10000.0f) double); + method @NonNull public android.location.GnssMeasurementCorrections.Builder setHorizontalPositionUncertaintyMeters(@FloatRange(from=0.0f) double); + method @NonNull public android.location.GnssMeasurementCorrections.Builder setLatitudeDegrees(@FloatRange(from=-90.0F, to=90.0f) double); + method @NonNull public android.location.GnssMeasurementCorrections.Builder setLongitudeDegrees(@FloatRange(from=-180.0F, to=180.0f) double); + method @NonNull public android.location.GnssMeasurementCorrections.Builder setSingleSatelliteCorrectionList(@NonNull java.util.List); + method @NonNull public android.location.GnssMeasurementCorrections.Builder setToaGpsNanosecondsOfWeek(@IntRange(from=0) long); + method @NonNull public android.location.GnssMeasurementCorrections.Builder setVerticalPositionUncertaintyMeters(@FloatRange(from=0.0f) double); } public final class GnssReflectingPlane implements android.os.Parcelable { method public int describeContents(); - method public double getAltitudeMeters(); - method public double getAzimuthDegrees(); - method public double getLatitudeDegrees(); - method public double getLongitudeDegrees(); - method public void writeToParcel(android.os.Parcel, int); - field @NonNull public static final android.os.Parcelable.Creator CREATOR; + method @FloatRange(from=-1000.0F, to=10000.0f) public double getAltitudeMeters(); + method @FloatRange(from=0.0f, to=360.0f) public double getAzimuthDegrees(); + method @FloatRange(from=-90.0F, to=90.0f) public double getLatitudeDegrees(); + method @FloatRange(from=-180.0F, to=180.0f) public double getLongitudeDegrees(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; } public static final class GnssReflectingPlane.Builder { ctor public GnssReflectingPlane.Builder(); - method public android.location.GnssReflectingPlane build(); - method public android.location.GnssReflectingPlane.Builder setAltitudeMeters(double); - method public android.location.GnssReflectingPlane.Builder setAzimuthDegrees(double); - method public android.location.GnssReflectingPlane.Builder setLatitudeDegrees(double); - method public android.location.GnssReflectingPlane.Builder setLongitudeDegrees(double); + method @NonNull public android.location.GnssReflectingPlane build(); + method @NonNull public android.location.GnssReflectingPlane.Builder setAltitudeMeters(@FloatRange(from=-1000.0F, to=10000.0f) double); + method @NonNull public android.location.GnssReflectingPlane.Builder setAzimuthDegrees(@FloatRange(from=0.0f, to=360.0f) double); + method @NonNull public android.location.GnssReflectingPlane.Builder setLatitudeDegrees(@FloatRange(from=-90.0F, to=90.0f) double); + method @NonNull public android.location.GnssReflectingPlane.Builder setLongitudeDegrees(@FloatRange(from=-180.0F, to=180.0f) double); } public final class GnssSingleSatCorrection implements android.os.Parcelable { method public int describeContents(); - method public float getCarrierFrequencyHz(); + method @FloatRange(from=0.0f, fromInclusive=false) public float getCarrierFrequencyHz(); method public int getConstellationType(); - method public float getExcessPathLengthMeters(); - method public float getExcessPathLengthUncertaintyMeters(); + method @FloatRange(from=0.0f) public float getExcessPathLengthMeters(); + method @FloatRange(from=0.0f) public float getExcessPathLengthUncertaintyMeters(); method @FloatRange(from=0.0f, to=1.0f) public float getProbabilityLineOfSight(); method @Nullable public android.location.GnssReflectingPlane getReflectingPlane(); - method public int getSatelliteId(); - method public int getSingleSatelliteCorrectionFlags(); + method @IntRange(from=0) public int getSatelliteId(); method public boolean hasExcessPathLength(); method public boolean hasExcessPathLengthUncertainty(); method public boolean hasReflectingPlane(); method public boolean hasValidSatelliteLineOfSight(); - method public void writeToParcel(android.os.Parcel, int); - field @NonNull public static final android.os.Parcelable.Creator CREATOR; - field public static final int HAS_EXCESS_PATH_LENGTH_MASK = 2; // 0x2 - field public static final int HAS_EXCESS_PATH_LENGTH_UNC_MASK = 4; // 0x4 - field public static final int HAS_PROB_SAT_IS_LOS_MASK = 1; // 0x1 - field public static final int HAS_REFLECTING_PLANE_MASK = 8; // 0x8 + method public void writeToParcel(@NonNull android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; } public static final class GnssSingleSatCorrection.Builder { ctor public GnssSingleSatCorrection.Builder(); - method public android.location.GnssSingleSatCorrection build(); - method public android.location.GnssSingleSatCorrection.Builder setCarrierFrequencyHz(float); - method public android.location.GnssSingleSatCorrection.Builder setConstellationType(int); - method public android.location.GnssSingleSatCorrection.Builder setExcessPathLengthMeters(float); - method public android.location.GnssSingleSatCorrection.Builder setExcessPathLengthUncertaintyMeters(float); - method public android.location.GnssSingleSatCorrection.Builder setProbabilityLineOfSight(@FloatRange(from=0.0f, to=1.0f) float); - method public android.location.GnssSingleSatCorrection.Builder setReflectingPlane(android.location.GnssReflectingPlane); - method public android.location.GnssSingleSatCorrection.Builder setSatelliteId(int); - method public android.location.GnssSingleSatCorrection.Builder setSingleSatelliteCorrectionFlags(int); + method @NonNull public android.location.GnssSingleSatCorrection build(); + method @NonNull public android.location.GnssSingleSatCorrection.Builder setCarrierFrequencyHz(@FloatRange(from=0.0f, fromInclusive=false) float); + method @NonNull public android.location.GnssSingleSatCorrection.Builder setConstellationType(int); + method @NonNull public android.location.GnssSingleSatCorrection.Builder setExcessPathLengthMeters(@FloatRange(from=0.0f) float); + method @NonNull public android.location.GnssSingleSatCorrection.Builder setExcessPathLengthUncertaintyMeters(@FloatRange(from=0.0f) float); + method @NonNull public android.location.GnssSingleSatCorrection.Builder setProbabilityLineOfSight(@FloatRange(from=0.0f, to=1.0f) float); + method @NonNull public android.location.GnssSingleSatCorrection.Builder setReflectingPlane(@Nullable android.location.GnssReflectingPlane); + method @NonNull public android.location.GnssSingleSatCorrection.Builder setSatelliteId(@IntRange(from=0) int); } public class GpsClock implements android.os.Parcelable { diff --git a/location/java/android/location/GnssMeasurementCorrections.java b/location/java/android/location/GnssMeasurementCorrections.java index fdbc3ddf8c31e..3e32c21da23b7 100644 --- a/location/java/android/location/GnssMeasurementCorrections.java +++ b/location/java/android/location/GnssMeasurementCorrections.java @@ -16,11 +16,16 @@ package android.location; +import android.annotation.FloatRange; +import android.annotation.IntRange; +import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; +import com.android.internal.util.Preconditions; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -35,37 +40,44 @@ import java.util.List; public final class GnssMeasurementCorrections implements Parcelable { /** Represents latitude in degrees at which the corrections are computed. */ - private double mLatitudeDegrees; + @FloatRange(from = -90.0f, to = 90.0f) + private final double mLatitudeDegrees; /** Represents longitude in degrees at which the corrections are computed. */ - private double mLongitudeDegrees; + @FloatRange(from = -180.0f, to = 180.0f) + private final double mLongitudeDegrees; /** * Represents altitude in meters above the WGS 84 reference ellipsoid at which the corrections * are computed. */ - private double mAltitudeMeters; + @FloatRange(from = -1000.0, to = 10000.0f) + private final double mAltitudeMeters; /** * Represents the horizontal uncertainty (68% confidence) in meters on the device position at * which the corrections are provided. * *

This value is useful for example to judge how accurate the provided corrections are. */ - private double mHorizontalPositionUncertaintyMeters; + @FloatRange(from = 0.0f) + private final double mHorizontalPositionUncertaintyMeters; /** * Represents the vertical uncertainty (68% confidence) in meters on the device position at * which the corrections are provided. * *

This value is useful for example to judge how accurate the provided corrections are. */ - private double mVerticalPositionUncertaintyMeters; + @FloatRange(from = 0.0f) + private final double mVerticalPositionUncertaintyMeters; /** Time Of Applicability, GPS time of week in nanoseconds. */ - private long mToaGpsNanosecondsOfWeek; + @IntRange(from = 0) + private final long mToaGpsNanosecondsOfWeek; /** * A set of {@link GnssSingleSatCorrection} each containing measurement corrections for a * satellite in view. */ - private @Nullable List mSingleSatCorrectionList; + @NonNull + private final List mSingleSatCorrectionList; private GnssMeasurementCorrections(Builder builder) { mLatitudeDegrees = builder.mLatitudeDegrees; @@ -74,19 +86,19 @@ public final class GnssMeasurementCorrections implements Parcelable { mHorizontalPositionUncertaintyMeters = builder.mHorizontalPositionUncertaintyMeters; mVerticalPositionUncertaintyMeters = builder.mVerticalPositionUncertaintyMeters; mToaGpsNanosecondsOfWeek = builder.mToaGpsNanosecondsOfWeek; - mSingleSatCorrectionList = - builder.mSingleSatCorrectionList == null - ? null - : Collections.unmodifiableList( - new ArrayList<>(builder.mSingleSatCorrectionList)); + final List singleSatCorrList = builder.mSingleSatCorrectionList; + Preconditions.checkArgument(singleSatCorrList != null && !singleSatCorrList.isEmpty()); + mSingleSatCorrectionList = Collections.unmodifiableList(new ArrayList<>(singleSatCorrList)); } /** Gets the latitude in degrees at which the corrections are computed. */ + @FloatRange(from = -90.0f, to = 90.0f) public double getLatitudeDegrees() { return mLatitudeDegrees; } /** Gets the longitude in degrees at which the corrections are computed. */ + @FloatRange(from = -180.0f, to = 180.0f) public double getLongitudeDegrees() { return mLongitudeDegrees; } @@ -95,6 +107,7 @@ public final class GnssMeasurementCorrections implements Parcelable { * Gets the altitude in meters above the WGS 84 reference ellipsoid at which the corrections are * computed. */ + @FloatRange(from = -1000.0f, to = 10000.0f) public double getAltitudeMeters() { return mAltitudeMeters; } @@ -103,6 +116,7 @@ public final class GnssMeasurementCorrections implements Parcelable { * Gets the horizontal uncertainty (68% confidence) in meters on the device position at * which the corrections are provided. */ + @FloatRange(from = 0.0f) public double getHorizontalPositionUncertaintyMeters() { return mHorizontalPositionUncertaintyMeters; } @@ -111,11 +125,13 @@ public final class GnssMeasurementCorrections implements Parcelable { * Gets the vertical uncertainty (68% confidence) in meters on the device position at * which the corrections are provided. */ + @FloatRange(from = 0.0f) public double getVerticalPositionUncertaintyMeters() { return mVerticalPositionUncertaintyMeters; } /** Gets the time of applicability, GPS time of week in nanoseconds. */ + @IntRange(from = 0) public long getToaGpsNanosecondsOfWeek() { return mToaGpsNanosecondsOfWeek; } @@ -124,7 +140,8 @@ public final class GnssMeasurementCorrections implements Parcelable { * Gets a set of {@link GnssSingleSatCorrection} each containing measurement corrections for a * satellite in view */ - public @Nullable List getSingleSatelliteCorrectionList() { + @NonNull + public List getSingleSatelliteCorrectionList() { return mSingleSatCorrectionList; } @@ -133,10 +150,11 @@ public final class GnssMeasurementCorrections implements Parcelable { return 0; } - public static final @android.annotation.NonNull Creator CREATOR = + public static final Creator CREATOR = new Creator() { @Override - public GnssMeasurementCorrections createFromParcel(Parcel parcel) { + @NonNull + public GnssMeasurementCorrections createFromParcel(@NonNull Parcel parcel) { final GnssMeasurementCorrections.Builder gnssMeasurementCorrectons = new Builder() .setLatitudeDegrees(parcel.readDouble()) @@ -148,7 +166,7 @@ public final class GnssMeasurementCorrections implements Parcelable { List singleSatCorrectionList = new ArrayList<>(); parcel.readTypedList(singleSatCorrectionList, GnssSingleSatCorrection.CREATOR); gnssMeasurementCorrectons.setSingleSatelliteCorrectionList( - singleSatCorrectionList.isEmpty() ? null : singleSatCorrectionList); + singleSatCorrectionList); return gnssMeasurementCorrectons.build(); } @@ -177,7 +195,7 @@ public final class GnssMeasurementCorrections implements Parcelable { } @Override - public void writeToParcel(Parcel parcel, int flags) { + public void writeToParcel(@NonNull Parcel parcel, int flags) { parcel.writeDouble(mLatitudeDegrees); parcel.writeDouble(mLongitudeDegrees); parcel.writeDouble(mAltitudeMeters); @@ -199,16 +217,18 @@ public final class GnssMeasurementCorrections implements Parcelable { private double mHorizontalPositionUncertaintyMeters; private double mVerticalPositionUncertaintyMeters; private long mToaGpsNanosecondsOfWeek; - private List mSingleSatCorrectionList; + @Nullable private List mSingleSatCorrectionList; /** Sets the latitude in degrees at which the corrections are computed. */ - public Builder setLatitudeDegrees(double latitudeDegrees) { + @NonNull public Builder setLatitudeDegrees( + @FloatRange(from = -90.0f, to = 90.0f) double latitudeDegrees) { mLatitudeDegrees = latitudeDegrees; return this; } /** Sets the longitude in degrees at which the corrections are computed. */ - public Builder setLongitudeDegrees(double longitudeDegrees) { + @NonNull public Builder setLongitudeDegrees( + @FloatRange(from = -180.0f, to = 180.0f) double longitudeDegrees) { mLongitudeDegrees = longitudeDegrees; return this; } @@ -217,7 +237,8 @@ public final class GnssMeasurementCorrections implements Parcelable { * Sets the altitude in meters above the WGS 84 reference ellipsoid at which the corrections * are computed. */ - public Builder setAltitudeMeters(double altitudeMeters) { + @NonNull public Builder setAltitudeMeters( + @FloatRange(from = -1000.0f, to = 10000.0f) double altitudeMeters) { mAltitudeMeters = altitudeMeters; return this; } @@ -227,8 +248,8 @@ public final class GnssMeasurementCorrections implements Parcelable { * Sets the horizontal uncertainty (68% confidence) in meters on the device position at * which the corrections are provided. */ - public Builder setHorizontalPositionUncertaintyMeters( - double horizontalPositionUncertaintyMeters) { + @NonNull public Builder setHorizontalPositionUncertaintyMeters( + @FloatRange(from = 0.0f) double horizontalPositionUncertaintyMeters) { mHorizontalPositionUncertaintyMeters = horizontalPositionUncertaintyMeters; return this; } @@ -237,14 +258,15 @@ public final class GnssMeasurementCorrections implements Parcelable { * Sets the vertical uncertainty (68% confidence) in meters on the device position at which * the corrections are provided. */ - public Builder setVerticalPositionUncertaintyMeters( - double verticalPositionUncertaintyMeters) { + @NonNull public Builder setVerticalPositionUncertaintyMeters( + @FloatRange(from = 0.0f) double verticalPositionUncertaintyMeters) { mVerticalPositionUncertaintyMeters = verticalPositionUncertaintyMeters; return this; } /** Sets the time of applicability, GPS time of week in nanoseconds. */ - public Builder setToaGpsNanosecondsOfWeek(long toaGpsNanosecondsOfWeek) { + @NonNull public Builder setToaGpsNanosecondsOfWeek( + @IntRange(from = 0) long toaGpsNanosecondsOfWeek) { mToaGpsNanosecondsOfWeek = toaGpsNanosecondsOfWeek; return this; } @@ -253,19 +275,14 @@ public final class GnssMeasurementCorrections implements Parcelable { * Sets a the list of {@link GnssSingleSatCorrection} containing measurement corrections for * a satellite in view */ - public Builder setSingleSatelliteCorrectionList( - @Nullable List singleSatCorrectionList) { - if (singleSatCorrectionList == null) { - mSingleSatCorrectionList = null; - } else { - mSingleSatCorrectionList = - Collections.unmodifiableList(new ArrayList<>(singleSatCorrectionList)); - } + @NonNull public Builder setSingleSatelliteCorrectionList( + @NonNull List singleSatCorrectionList) { + mSingleSatCorrectionList = singleSatCorrectionList; return this; } /** Builds a {@link GnssMeasurementCorrections} instance as specified by this builder. */ - public GnssMeasurementCorrections build() { + @NonNull public GnssMeasurementCorrections build() { return new GnssMeasurementCorrections(this); } } diff --git a/location/java/android/location/GnssReflectingPlane.java b/location/java/android/location/GnssReflectingPlane.java index c5095d7747e9b..9d05287f6b760 100644 --- a/location/java/android/location/GnssReflectingPlane.java +++ b/location/java/android/location/GnssReflectingPlane.java @@ -16,6 +16,8 @@ package android.location; +import android.annotation.FloatRange; +import android.annotation.NonNull; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; @@ -29,17 +31,21 @@ import android.os.Parcelable; public final class GnssReflectingPlane implements Parcelable { /** Represents latitude in degrees of the reflecting plane */ - private double mLatitudeDegrees; + @FloatRange(from = -90.0f, to = 90.0f) + private final double mLatitudeDegrees; /** Represents longitude in degrees of the reflecting plane. */ - private double mLongitudeDegrees; + @FloatRange(from = -180.0f, to = 180.0f) + private final double mLongitudeDegrees; /** * Represents altitude in meters above the WGS 84 reference ellipsoid of the reflection point in * the plane */ - private double mAltitudeMeters; + @FloatRange(from = -1000.0f, to = 10000.0f) + private final double mAltitudeMeters; /** Represents azimuth clockwise from north of the reflecting plane in degrees. */ - private double mAzimuthDegrees; + @FloatRange(from = 0.0f, to = 360.0f) + private final double mAzimuthDegrees; private GnssReflectingPlane(Builder builder) { mLatitudeDegrees = builder.mLatitudeDegrees; @@ -49,11 +55,13 @@ public final class GnssReflectingPlane implements Parcelable { } /** Gets the latitude in degrees of the reflecting plane. */ + @FloatRange(from = -90.0f, to = 90.0f) public double getLatitudeDegrees() { return mLatitudeDegrees; } /** Gets the longitude in degrees of the reflecting plane. */ + @FloatRange(from = -180.0f, to = 180.0f) public double getLongitudeDegrees() { return mLongitudeDegrees; } @@ -62,11 +70,13 @@ public final class GnssReflectingPlane implements Parcelable { * Gets the altitude in meters above the WGS 84 reference ellipsoid of the reflecting point * within the plane */ + @FloatRange(from = -1000.0f, to = 10000.0f) public double getAltitudeMeters() { return mAltitudeMeters; } /** Gets the azimuth clockwise from north of the reflecting plane in degrees. */ + @FloatRange(from = 0.0f, to = 360.0f) public double getAzimuthDegrees() { return mAzimuthDegrees; } @@ -76,10 +86,11 @@ public final class GnssReflectingPlane implements Parcelable { return 0; } - public static final @android.annotation.NonNull Creator CREATOR = + public static final Creator CREATOR = new Creator() { @Override - public GnssReflectingPlane createFromParcel(Parcel parcel) { + @NonNull + public GnssReflectingPlane createFromParcel(@NonNull Parcel parcel) { GnssReflectingPlane reflectingPlane = new Builder() .setLatitudeDegrees(parcel.readDouble()) @@ -108,7 +119,7 @@ public final class GnssReflectingPlane implements Parcelable { } @Override - public void writeToParcel(Parcel parcel, int flags) { + public void writeToParcel(@NonNull Parcel parcel, int flags) { parcel.writeDouble(mLatitudeDegrees); parcel.writeDouble(mLongitudeDegrees); parcel.writeDouble(mAltitudeMeters); @@ -119,19 +130,20 @@ public final class GnssReflectingPlane implements Parcelable { public static final class Builder { /** For documentation, see corresponding fields in {@link GnssReflectingPlane}. */ private double mLatitudeDegrees; - private double mLongitudeDegrees; private double mAltitudeMeters; private double mAzimuthDegrees; /** Sets the latitude in degrees of the reflecting plane. */ - public Builder setLatitudeDegrees(double latitudeDegrees) { + @NonNull public Builder setLatitudeDegrees( + @FloatRange(from = -90.0f, to = 90.0f) double latitudeDegrees) { mLatitudeDegrees = latitudeDegrees; return this; } /** Sets the longitude in degrees of the reflecting plane. */ - public Builder setLongitudeDegrees(double longitudeDegrees) { + @NonNull public Builder setLongitudeDegrees( + @FloatRange(from = -180.0f, to = 180.0f) double longitudeDegrees) { mLongitudeDegrees = longitudeDegrees; return this; } @@ -140,19 +152,21 @@ public final class GnssReflectingPlane implements Parcelable { * Sets the altitude in meters above the WGS 84 reference ellipsoid of the reflecting point * within the plane */ - public Builder setAltitudeMeters(double altitudeMeters) { + @NonNull public Builder setAltitudeMeters( + @FloatRange(from = -1000.0f, to = 10000.0f) double altitudeMeters) { mAltitudeMeters = altitudeMeters; return this; } /** Sets the azimuth clockwise from north of the reflecting plane in degrees. */ - public Builder setAzimuthDegrees(double azimuthDegrees) { + @NonNull public Builder setAzimuthDegrees( + @FloatRange(from = 0.0f, to = 360.0f) double azimuthDegrees) { mAzimuthDegrees = azimuthDegrees; return this; } /** Builds a {@link GnssReflectingPlane} object as specified by this builder. */ - public GnssReflectingPlane build() { + @NonNull public GnssReflectingPlane build() { return new GnssReflectingPlane(this); } } diff --git a/location/java/android/location/GnssSingleSatCorrection.java b/location/java/android/location/GnssSingleSatCorrection.java index dbf3fd9762eab..e9019097e3277 100644 --- a/location/java/android/location/GnssSingleSatCorrection.java +++ b/location/java/android/location/GnssSingleSatCorrection.java @@ -17,6 +17,8 @@ package android.location; import android.annotation.FloatRange; +import android.annotation.IntRange; +import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.os.Parcel; @@ -35,40 +37,49 @@ public final class GnssSingleSatCorrection implements Parcelable { /** * Bit mask for {@link #mSingleSatCorrectionFlags} indicating the presence of {@link * #mProbSatIsLos}. + * + * @hide */ public static final int HAS_PROB_SAT_IS_LOS_MASK = 1 << 0; /** * Bit mask for {@link #mSingleSatCorrectionFlags} indicating the presence of {@link * #mExcessPathLengthMeters}. + * + * @hide */ public static final int HAS_EXCESS_PATH_LENGTH_MASK = 1 << 1; /** * Bit mask for {@link #mSingleSatCorrectionFlags} indicating the presence of {@link * #mExcessPathLengthUncertaintyMeters}. + * + * @hide */ public static final int HAS_EXCESS_PATH_LENGTH_UNC_MASK = 1 << 2; /** * Bit mask for {@link #mSingleSatCorrectionFlags} indicating the presence of {@link * #mReflectingPlane}. + * + * @hide */ public static final int HAS_REFLECTING_PLANE_MASK = 1 << 3; /** A bitmask of fields present in this object (see HAS_* constants defined above) */ - private int mSingleSatCorrectionFlags; + private final int mSingleSatCorrectionFlags; /** Defines the constellation of the given satellite as defined in {@link GnssStatus}. */ @GnssStatus.ConstellationType - private int mConstellationType; + private final int mConstellationType; /** * Satellite vehicle ID number * *

Interpretation depends on {@link GnssStatus#getSvid(int)}. */ - private int mSatId; + @IntRange(from = 0) + private final int mSatId; /** * Carrier frequency of the signal to be corrected, for example it can be the GPS center @@ -79,22 +90,25 @@ public final class GnssSingleSatCorrection implements Parcelable { * values related to L1 will be filled, and in the other all of the values related to L5 will be * filled. */ - private float mCarrierFrequencyHz; + @FloatRange(from = 0.0f, fromInclusive = false) + private final float mCarrierFrequencyHz; /** * The probability that the satellite is estimated to be in Line-of-Sight condition at the given * location. */ - @FloatRange(from = 0f, to = 1f) - private float mProbSatIsLos; + @FloatRange(from = 0.0f, to = 1.0f) + private final float mProbSatIsLos; /** * Excess path length to be subtracted from pseudorange before using it in calculating location. */ - private float mExcessPathLengthMeters; + @FloatRange(from = 0.0f) + private final float mExcessPathLengthMeters; /** Error estimate (1-sigma) for the Excess path length estimate */ - private float mExcessPathLengthUncertaintyMeters; + @FloatRange(from = 0.0f) + private final float mExcessPathLengthUncertaintyMeters; /** * Defines the reflecting plane location and azimuth information @@ -102,7 +116,8 @@ public final class GnssSingleSatCorrection implements Parcelable { *

The flag HAS_REFLECTING_PLANE will be used to set this value to invalid if the satellite * signal goes through multiple reflections or if reflection plane serving is not supported. */ - private @Nullable GnssReflectingPlane mReflectingPlane; + @Nullable + private final GnssReflectingPlane mReflectingPlane; private GnssSingleSatCorrection(Builder builder) { mSingleSatCorrectionFlags = builder.mSingleSatCorrectionFlags; @@ -115,7 +130,11 @@ public final class GnssSingleSatCorrection implements Parcelable { mReflectingPlane = builder.mReflectingPlane; } - /** Gets a bitmask of fields present in this object */ + /** + * Gets a bitmask of fields present in this object + * + * @hide + */ public int getSingleSatelliteCorrectionFlags() { return mSingleSatCorrectionFlags; } @@ -137,6 +156,7 @@ public final class GnssSingleSatCorrection implements Parcelable { *

Interpretation depends on {@link #getConstellationType()}. See {@link * GnssStatus#getSvid(int)}. */ + @IntRange(from = 0) public int getSatelliteId() { return mSatId; } @@ -154,6 +174,7 @@ public final class GnssSingleSatCorrection implements Parcelable { * * @return the carrier frequency of the signal tracked in Hz. */ + @FloatRange(from = 0.0f, fromInclusive = false) public float getCarrierFrequencyHz() { return mCarrierFrequencyHz; } @@ -162,7 +183,7 @@ public final class GnssSingleSatCorrection implements Parcelable { * Returns the probability that the satellite is in line-of-sight condition at the given * location. */ - @FloatRange(from = 0f, to = 1f) + @FloatRange(from = 0.0f, to = 1.0f) public float getProbabilityLineOfSight() { return mProbSatIsLos; } @@ -171,11 +192,13 @@ public final class GnssSingleSatCorrection implements Parcelable { * Returns the Excess path length to be subtracted from pseudorange before using it in * calculating location. */ + @FloatRange(from = 0.0f) public float getExcessPathLengthMeters() { return mExcessPathLengthMeters; } /** Returns the error estimate (1-sigma) for the Excess path length estimate */ + @FloatRange(from = 0.0f) public float getExcessPathLengthUncertaintyMeters() { return mExcessPathLengthUncertaintyMeters; } @@ -186,7 +209,8 @@ public final class GnssSingleSatCorrection implements Parcelable { *

The flag HAS_REFLECTING_PLANE will be used to set this value to invalid if the satellite * signal goes through multiple reflections or if reflection plane serving is not supported */ - public @Nullable GnssReflectingPlane getReflectingPlane() { + @Nullable + public GnssReflectingPlane getReflectingPlane() { return mReflectingPlane; } @@ -215,23 +239,27 @@ public final class GnssSingleSatCorrection implements Parcelable { return 0; } - public static final @android.annotation.NonNull Creator CREATOR = + public static final Creator CREATOR = new Creator() { @Override - public GnssSingleSatCorrection createFromParcel(Parcel parcel) { - GnssSingleSatCorrection singleSatCorrection = + @NonNull + public GnssSingleSatCorrection createFromParcel(@NonNull Parcel parcel) { + int mSingleSatCorrectionFlags = parcel.readInt(); + boolean hasReflectingPlane = + (mSingleSatCorrectionFlags & HAS_REFLECTING_PLANE_MASK) != 0; + final GnssSingleSatCorrection.Builder singleSatCorrectionBuilder = new Builder() - .setSingleSatelliteCorrectionFlags(parcel.readInt()) .setConstellationType(parcel.readInt()) .setSatelliteId(parcel.readInt()) .setCarrierFrequencyHz(parcel.readFloat()) .setProbabilityLineOfSight(parcel.readFloat()) .setExcessPathLengthMeters(parcel.readFloat()) - .setExcessPathLengthUncertaintyMeters(parcel.readFloat()) - .setReflectingPlane( - GnssReflectingPlane.CREATOR.createFromParcel(parcel)) - .build(); - return singleSatCorrection; + .setExcessPathLengthUncertaintyMeters(parcel.readFloat()); + if (hasReflectingPlane) { + singleSatCorrectionBuilder.setReflectingPlane( + GnssReflectingPlane.CREATOR.createFromParcel(parcel)); + } + return singleSatCorrectionBuilder.build(); } @Override @@ -256,12 +284,14 @@ public final class GnssSingleSatCorrection implements Parcelable { format, "ExcessPathLengthUncertaintyMeters = ", mExcessPathLengthUncertaintyMeters)); - builder.append(String.format(format, "ReflectingPlane = ", mReflectingPlane)); + if (hasReflectingPlane()) { + builder.append(String.format(format, "ReflectingPlane = ", mReflectingPlane)); + } return builder.toString(); } @Override - public void writeToParcel(Parcel parcel, int flags) { + public void writeToParcel(@NonNull Parcel parcel, int flags) { parcel.writeInt(mSingleSatCorrectionFlags); parcel.writeInt(mConstellationType); parcel.writeInt(mSatId); @@ -269,7 +299,9 @@ public final class GnssSingleSatCorrection implements Parcelable { parcel.writeFloat(mProbSatIsLos); parcel.writeFloat(mExcessPathLengthMeters); parcel.writeFloat(mExcessPathLengthUncertaintyMeters); - mReflectingPlane.writeToParcel(parcel, flags); + if (hasReflectingPlane()) { + mReflectingPlane.writeToParcel(parcel, flags); + } } /** Builder for {@link GnssSingleSatCorrection} */ @@ -287,28 +319,25 @@ public final class GnssSingleSatCorrection implements Parcelable { private float mProbSatIsLos; private float mExcessPathLengthMeters; private float mExcessPathLengthUncertaintyMeters; + @Nullable private GnssReflectingPlane mReflectingPlane; - /** Sets a bitmask of fields present in this object */ - public Builder setSingleSatelliteCorrectionFlags(int singleSatCorrectionFlags) { - mSingleSatCorrectionFlags = singleSatCorrectionFlags; - return this; - } - /** Sets the constellation type. */ - public Builder setConstellationType(@GnssStatus.ConstellationType int constellationType) { + @NonNull public Builder setConstellationType( + @GnssStatus.ConstellationType int constellationType) { mConstellationType = constellationType; return this; } /** Sets the Satellite ID defined in the ICD of the given constellation. */ - public Builder setSatelliteId(int satId) { + @NonNull public Builder setSatelliteId(@IntRange(from = 0) int satId) { mSatId = satId; return this; } /** Sets the Carrier frequency in Hz. */ - public Builder setCarrierFrequencyHz(float carrierFrequencyHz) { + @NonNull public Builder setCarrierFrequencyHz( + @FloatRange(from = 0.0f, fromInclusive = false) float carrierFrequencyHz) { mCarrierFrequencyHz = carrierFrequencyHz; return this; } @@ -317,8 +346,8 @@ public final class GnssSingleSatCorrection implements Parcelable { * Sets the line-of-sight probability of the satellite at the given location in the range * between 0 and 1. */ - public Builder setProbabilityLineOfSight( - @FloatRange(from = 0f, to = 1f) float probSatIsLos) { + @NonNull public Builder setProbabilityLineOfSight( + @FloatRange(from = 0.0f, to = 1.0f) float probSatIsLos) { Preconditions.checkArgumentInRange( probSatIsLos, 0, 1, "probSatIsLos should be between 0 and 1."); mProbSatIsLos = probSatIsLos; @@ -331,7 +360,8 @@ public final class GnssSingleSatCorrection implements Parcelable { * Sets the Excess path length to be subtracted from pseudorange before using it in * calculating location. */ - public Builder setExcessPathLengthMeters(float excessPathLengthMeters) { + @NonNull public Builder setExcessPathLengthMeters( + @FloatRange(from = 0.0f) float excessPathLengthMeters) { mExcessPathLengthMeters = excessPathLengthMeters; mSingleSatCorrectionFlags = (byte) (mSingleSatCorrectionFlags | HAS_EXCESS_PATH_LENGTH_MASK); @@ -339,8 +369,8 @@ public final class GnssSingleSatCorrection implements Parcelable { } /** Sets the error estimate (1-sigma) for the Excess path length estimate */ - public Builder setExcessPathLengthUncertaintyMeters( - float excessPathLengthUncertaintyMeters) { + @NonNull public Builder setExcessPathLengthUncertaintyMeters( + @FloatRange(from = 0.0f) float excessPathLengthUncertaintyMeters) { mExcessPathLengthUncertaintyMeters = excessPathLengthUncertaintyMeters; mSingleSatCorrectionFlags = (byte) (mSingleSatCorrectionFlags | HAS_EXCESS_PATH_LENGTH_UNC_MASK); @@ -348,15 +378,20 @@ public final class GnssSingleSatCorrection implements Parcelable { } /** Sets the reflecting plane information */ - public Builder setReflectingPlane(GnssReflectingPlane reflectingPlane) { + @NonNull public Builder setReflectingPlane(@Nullable GnssReflectingPlane reflectingPlane) { mReflectingPlane = reflectingPlane; - mSingleSatCorrectionFlags = - (byte) (mSingleSatCorrectionFlags | HAS_REFLECTING_PLANE_MASK); + if (reflectingPlane != null) { + mSingleSatCorrectionFlags = + (byte) (mSingleSatCorrectionFlags | HAS_REFLECTING_PLANE_MASK); + } else { + mSingleSatCorrectionFlags = + (byte) (mSingleSatCorrectionFlags & ~HAS_REFLECTING_PLANE_MASK); + } return this; } /** Builds a {@link GnssSingleSatCorrection} instance as specified by this builder. */ - public GnssSingleSatCorrection build() { + @NonNull public GnssSingleSatCorrection build() { return new GnssSingleSatCorrection(this); } } diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp index 298b664beb959..bce3e98c7baa4 100644 --- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp +++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp @@ -160,6 +160,8 @@ using IAGnssCallback_V2_0 = android::hardware::gnss::V2_0::IAGnssCallback; using IMeasurementCorrections = android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrections; +using GnssSingleSatCorrectionFlags = + android::hardware::gnss::measurement_corrections::V1_0::GnssSingleSatCorrectionFlags; using android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl; using android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControlCallback; @@ -199,9 +201,7 @@ sp gnssMeasurementIface_V1_1 = nullptr; sp gnssMeasurementIface_V2_0 = nullptr; sp gnssNavigationMessageIface = nullptr; sp gnssCorrectionsIface = nullptr; -// This boolean is needed to ensure that Gnsss Measurement Corrections related method are only -// initalized when needed which will be few devices initially -bool firstGnssMeasurementCorrectionInjected = false; + sp gnssVisibilityControlIface = nullptr; #define WAKE_LOCK_NAME "GPS" @@ -1471,6 +1471,51 @@ static void android_location_GnssLocationProvider_init_once(JNIEnv* env, jclass "(Ljava/lang/String;BLjava/lang/String;BLjava/lang/String;BZZ)V"); method_isInEmergencySession = env->GetMethodID(clazz, "isInEmergencySession", "()Z"); + jclass measCorrClass = env->FindClass("android/location/GnssMeasurementCorrections"); + method_correctionsGetLatitudeDegrees = env->GetMethodID( + measCorrClass,"getLatitudeDegrees", "()D"); + method_correctionsGetLongitudeDegrees = env->GetMethodID( + measCorrClass, "getLongitudeDegrees", "()D"); + method_correctionsGetAltitudeMeters = env->GetMethodID( + measCorrClass, "getAltitudeMeters", "()D"); + method_correctionsGetHorPosUncMeters = env->GetMethodID( + measCorrClass, "getHorizontalPositionUncertaintyMeters", "()D"); + method_correctionsGetVerPosUncMeters = env->GetMethodID( + measCorrClass, "getVerticalPositionUncertaintyMeters", "()D"); + method_correctionsGetToaGpsNanosecondsOfWeek = env->GetMethodID( + measCorrClass, "getToaGpsNanosecondsOfWeek", "()J"); + + method_correctionsGetSingleSatCorrectionList = env->GetMethodID( + measCorrClass, "getSingleSatelliteCorrectionList", "()Ljava/util/List;"); + + jclass corrListClass = env->FindClass("java/util/List"); + method_listSize = env->GetMethodID(corrListClass, "size", "()I"); + method_correctionListGet = env->GetMethodID(corrListClass, "get", "(I)Ljava/lang/Object;"); + + jclass singleSatCorrClass = env->FindClass("android/location/GnssSingleSatCorrection"); + method_correctionSatFlags = env->GetMethodID( + singleSatCorrClass, "getSingleSatelliteCorrectionFlags", "()I"); + method_correctionSatConstType = env->GetMethodID( + singleSatCorrClass, "getConstellationType", "()I"); + method_correctionSatId= env->GetMethodID( + singleSatCorrClass, "getSatelliteId", "()I"); + method_correctionSatCarrierFreq = env->GetMethodID( + singleSatCorrClass, "getCarrierFrequencyHz", "()F"); + method_correctionSatIsLosProb = env->GetMethodID( + singleSatCorrClass,"getProbabilityLineOfSight", "()F"); + method_correctionSatEpl = env->GetMethodID( + singleSatCorrClass, "getExcessPathLengthMeters", "()F"); + method_correctionSatEplUnc = env->GetMethodID( + singleSatCorrClass, "getExcessPathLengthUncertaintyMeters", "()F"); + method_correctionSatRefPlane = env->GetMethodID( + singleSatCorrClass, "getReflectingPlane", "()Landroid/location/GnssReflectingPlane;"); + + jclass refPlaneClass = env->FindClass("android/location/GnssReflectingPlane"); + method_correctionPlaneLatDeg = env->GetMethodID(refPlaneClass, "getLatitudeDegrees", "()D"); + method_correctionPlaneLngDeg = env->GetMethodID(refPlaneClass, "getLongitudeDegrees", "()D"); + method_correctionPlaneAltDeg = env->GetMethodID(refPlaneClass, "getAltitudeMeters", "()D"); + method_correctionPlaneAzimDeg = env->GetMethodID(refPlaneClass, "getAzimuthDegrees", "()D"); + /* * Save a pointer to JVM. */ @@ -2341,29 +2386,6 @@ static jboolean android_location_GnssMeasurementsProvider_inject_gnss_measuremen ALOGW("Trying to inject GNSS corrections on a chipset that does not support them."); return JNI_FALSE; } - if (firstGnssMeasurementCorrectionInjected == false) { - jclass measCorrClass = env->GetObjectClass(correctionsObj); - method_correctionsGetLatitudeDegrees = env->GetMethodID( - measCorrClass,"getLatitudeDegrees", "()D"); - - method_correctionsGetLongitudeDegrees = env->GetMethodID( - measCorrClass, "getLongitudeDegrees", "()D"); - - method_correctionsGetAltitudeMeters = env->GetMethodID( - measCorrClass, "getAltitudeMeters", "()D"); - - method_correctionsGetHorPosUncMeters = env->GetMethodID( - measCorrClass, "getHorizontalPositionUncertaintyMeters", "()D"); - - method_correctionsGetVerPosUncMeters = env->GetMethodID( - measCorrClass, "getVerticalPositionUncertaintyMeters", "()D"); - - method_correctionsGetToaGpsNanosecondsOfWeek = env->GetMethodID( - measCorrClass, "getToaGpsNanosecondsOfWeek", "()J"); - - method_correctionsGetSingleSatCorrectionList = env->GetMethodID( - measCorrClass, "getSingleSatelliteCorrectionList", "()Ljava.util.List;"); - } jdouble latitudeDegreesCorr = env->CallDoubleMethod( correctionsObj, method_correctionsGetLatitudeDegrees); @@ -2380,42 +2402,18 @@ static jboolean android_location_GnssMeasurementsProvider_inject_gnss_measuremen jobject singleSatCorrectionList = env->CallObjectMethod(correctionsObj, method_correctionsGetSingleSatCorrectionList); - if (firstGnssMeasurementCorrectionInjected == false) { - jclass corrListClass = env->GetObjectClass(singleSatCorrectionList); - method_listSize = env->GetMethodID(corrListClass, "size", "()I"); - method_correctionListGet = env->GetMethodID( - corrListClass, "get", "(I)Landroid/location/GnssSingleSatCorrection;"); - } - auto len = (singleSatCorrectionList == nullptr) ? 0 : env->CallIntMethod(singleSatCorrectionList, method_listSize); + if (len == 0) { + ALOGI("Empty correction list injected....Returning with no HAL injection"); + return JNI_TRUE; + } hidl_vec list(len); for (uint16_t i = 0; i < len; ++i) { jobject singleSatCorrectionObj = env->CallObjectMethod( - singleSatCorrectionList, method_correctionListGet, i); - - if (firstGnssMeasurementCorrectionInjected == false) { - jclass singleSatCorrClass = env->GetObjectClass(singleSatCorrectionObj); - method_correctionSatFlags = env->GetMethodID( - singleSatCorrClass, "getSingleSatelliteCorrectionFlags", "()I"); - method_correctionSatConstType = env->GetMethodID( - singleSatCorrClass, "getConstellationType", "()I"); - method_correctionSatId= env->GetMethodID( - singleSatCorrClass, "getSatelliteId", "()I"); - method_correctionSatCarrierFreq = env->GetMethodID( - singleSatCorrClass, "getCarrierFrequencyHz", "()F"); - method_correctionSatIsLosProb = env->GetMethodID( - singleSatCorrClass,"getProbabilityLineOfSight", "()F"); - method_correctionSatEpl = env->GetMethodID( - singleSatCorrClass, "getExcessPathLengthMeters", "()F"); - method_correctionSatEplUnc = env->GetMethodID( - singleSatCorrClass, "getExcessPathLengthUncertaintyMeters", "()F"); - method_correctionSatRefPlane = env->GetMethodID( - singleSatCorrClass, "getReflectingPlane", - "()Landroid/location/GnssReflectingPlane;"); - } + singleSatCorrectionList, method_correctionListGet, i); jint correctionFlags = env->CallIntMethod(singleSatCorrectionObj, method_correctionSatFlags); @@ -2431,38 +2429,34 @@ static jboolean android_location_GnssMeasurementsProvider_inject_gnss_measuremen env->CallFloatMethod(singleSatCorrectionObj, method_correctionSatEpl); jfloat eplUncMeters = env->CallFloatMethod(singleSatCorrectionObj, method_correctionSatEplUnc); - jobject reflectingPlaneObj = env->CallObjectMethod( - singleSatCorrectionObj, method_correctionSatRefPlane); - - if (firstGnssMeasurementCorrectionInjected == false) { - jclass refPlaneClass = env->GetObjectClass(reflectingPlaneObj); - method_correctionPlaneLatDeg = env->GetMethodID( - refPlaneClass, "getLatitudeDegrees", "()D"); - method_correctionPlaneLngDeg = env->GetMethodID( - refPlaneClass, "getLongitudeDegrees", "()D"); - method_correctionPlaneAltDeg = env->GetMethodID( - refPlaneClass, "getAltitudeMeters", "()D"); - method_correctionPlaneAzimDeg = env->GetMethodID( - refPlaneClass, "getAzimuthDegrees", "()D"); + uint16_t corrFlags = static_cast(correctionFlags); + jobject reflectingPlaneObj; + bool has_ref_plane = (corrFlags & GnssSingleSatCorrectionFlags::HAS_REFLECTING_PLANE) != 0; + if (has_ref_plane) { + reflectingPlaneObj = env->CallObjectMethod( + singleSatCorrectionObj, method_correctionSatRefPlane); } - jdouble latitudeDegreesRefPlane = env->CallDoubleMethod( - reflectingPlaneObj, method_correctionPlaneLatDeg); - jdouble longitudeDegreesRefPlane = env->CallDoubleMethod( - reflectingPlaneObj, method_correctionPlaneLngDeg); - jdouble altitudeDegreesRefPlane = env->CallDoubleMethod( - reflectingPlaneObj, method_correctionPlaneAltDeg); - jdouble azimuthDegreeRefPlane = env->CallDoubleMethod( - reflectingPlaneObj, method_correctionPlaneAzimDeg); - ReflectingPlane reflectingPlane = { - .latitudeDegrees = latitudeDegreesRefPlane, - .longitudeDegrees = longitudeDegreesRefPlane, - .altitudeMeters = altitudeDegreesRefPlane, - .azimuthDegrees = azimuthDegreeRefPlane, - }; + ReflectingPlane reflectingPlane; + if (has_ref_plane) { + jdouble latitudeDegreesRefPlane = env->CallDoubleMethod( + reflectingPlaneObj, method_correctionPlaneLatDeg); + jdouble longitudeDegreesRefPlane = env->CallDoubleMethod( + reflectingPlaneObj, method_correctionPlaneLngDeg); + jdouble altitudeDegreesRefPlane = env->CallDoubleMethod( + reflectingPlaneObj, method_correctionPlaneAltDeg); + jdouble azimuthDegreeRefPlane = env->CallDoubleMethod( + reflectingPlaneObj, method_correctionPlaneAzimDeg); + reflectingPlane = { + .latitudeDegrees = latitudeDegreesRefPlane, + .longitudeDegrees = longitudeDegreesRefPlane, + .altitudeMeters = altitudeDegreesRefPlane, + .azimuthDegrees = azimuthDegreeRefPlane, + }; + } SingleSatCorrection singleSatCorrection = { - .singleSatCorrectionFlags = static_cast(correctionFlags), + .singleSatCorrectionFlags = corrFlags, .constellation = static_cast(constType), .svid = static_cast(satId), .carrierFrequencyHz = carrierFreqHz, @@ -2484,7 +2478,6 @@ static jboolean android_location_GnssMeasurementsProvider_inject_gnss_measuremen }; gnssCorrectionsIface->setCorrections(measurementCorrections); - firstGnssMeasurementCorrectionInjected = true; return JNI_TRUE; }