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

Commit 195bafa1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Bluesky add position uncertainty field"

parents bd8c27ee 6ec95382
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2959,10 +2959,12 @@ 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<android.location.GnssSingleSatCorrection> getSingleSatCorrectionList();
    method public long getToaGpsNanosecondsOfWeek();
    method public double getVerticalPositionUncertaintyMeters();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.location.GnssMeasurementCorrections> CREATOR;
  }
@@ -2971,10 +2973,12 @@ package android.location {
    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 setSingleSatCorrectionList(@Nullable java.util.List<android.location.GnssSingleSatCorrection>);
    method public android.location.GnssMeasurementCorrections.Builder setToaGpsNanosecondsOfWeek(long);
    method public android.location.GnssMeasurementCorrections.Builder setVerticalPositionUncertaintyMeters(double);
  }
  public final class GnssReflectingPlane implements android.os.Parcelable {
+65 −3
Original line number Diff line number Diff line
@@ -43,13 +43,27 @@ public final class GnssMeasurementCorrections implements Parcelable {
     * are computed.
     */
    private double mAltitudeMeters;
    /**
     * Represents the horizontal uncertainty (68% confidence) in meters on the device position at
     * which the corrections are provided.
     *
     * <p> This value is useful for example to judge how accurate the provided corrections are.
     */
    private double mHorizontalPositionUncertaintyMeters;
    /**
     * Represents the vertical uncertainty (68% confidence) in meters on the device position at
     * which the corrections are provided.
     *
     * <p> This value is useful for example to judge how accurate the provided corrections are.
     */
    private double mVerticalPositionUncertaintyMeters;

    /** Time Of Applicability, GPS time of week */
    /** Time Of Applicability, GPS time of week in nanoseconds. */
    private long mToaGpsNanosecondsOfWeek;

    /**
     * A set of {@link GnssSingleSatCorrection} each containing measurement corrections for a
     * satellite in view
     * satellite in view.
     */
    private @Nullable List<GnssSingleSatCorrection> mSingleSatCorrectionList;

@@ -57,6 +71,8 @@ public final class GnssMeasurementCorrections implements Parcelable {
        mLatitudeDegrees = builder.mLatitudeDegrees;
        mLongitudeDegrees = builder.mLongitudeDegrees;
        mAltitudeMeters = builder.mAltitudeMeters;
        mHorizontalPositionUncertaintyMeters = builder.mHorizontalPositionUncertaintyMeters;
        mVerticalPositionUncertaintyMeters = builder.mVerticalPositionUncertaintyMeters;
        mToaGpsNanosecondsOfWeek = builder.mToaGpsNanosecondsOfWeek;
        mSingleSatCorrectionList =
                builder.mSingleSatCorrectionList == null
@@ -83,6 +99,22 @@ public final class GnssMeasurementCorrections implements Parcelable {
        return mAltitudeMeters;
    }

    /**
     * Gets the horizontal uncertainty (68% confidence) in meters on the device position at
     * which the corrections are provided.
     */
    public double getHorizontalPositionUncertaintyMeters() {
        return mHorizontalPositionUncertaintyMeters;
    }

    /**
     * Gets the vertical uncertainty (68% confidence) in meters on the device position at
     * which the corrections are provided.
     */
    public double getVerticalPositionUncertaintyMeters() {
        return mVerticalPositionUncertaintyMeters;
    }

    /** Gets the time of applicability, GPS time of week in nanoseconds. */
    public long getToaGpsNanosecondsOfWeek() {
        return mToaGpsNanosecondsOfWeek;
@@ -110,6 +142,8 @@ public final class GnssMeasurementCorrections implements Parcelable {
                                    .setLatitudeDegrees(parcel.readDouble())
                                    .setLongitudeDegrees(parcel.readDouble())
                                    .setAltitudeMeters(parcel.readDouble())
                                    .setHorizontalPositionUncertaintyMeters(parcel.readDouble())
                                    .setVerticalPositionUncertaintyMeters(parcel.readDouble())
                                    .setToaGpsNanosecondsOfWeek(parcel.readLong());
                    List<GnssSingleSatCorrection> singleSatCorrectionList = new ArrayList<>();
                    parcel.readTypedList(singleSatCorrectionList, GnssSingleSatCorrection.CREATOR);
@@ -131,6 +165,10 @@ public final class GnssMeasurementCorrections implements Parcelable {
        builder.append(String.format(format, "LatitudeDegrees = ", mLatitudeDegrees));
        builder.append(String.format(format, "LongitudeDegrees = ", mLongitudeDegrees));
        builder.append(String.format(format, "AltitudeMeters = ", mAltitudeMeters));
        builder.append(String.format(format, "HorizontalPositionUncertaintyMeters = ",
                mHorizontalPositionUncertaintyMeters));
        builder.append(String.format(format, "VerticalPositionUncertaintyMeters = ",
                mVerticalPositionUncertaintyMeters));
        builder.append(
                String.format(format, "ToaGpsNanosecondsOfWeek = ", mToaGpsNanosecondsOfWeek));
        builder.append(
@@ -143,6 +181,8 @@ public final class GnssMeasurementCorrections implements Parcelable {
        parcel.writeDouble(mLatitudeDegrees);
        parcel.writeDouble(mLongitudeDegrees);
        parcel.writeDouble(mAltitudeMeters);
        parcel.writeDouble(mHorizontalPositionUncertaintyMeters);
        parcel.writeDouble(mVerticalPositionUncertaintyMeters);
        parcel.writeLong(mToaGpsNanosecondsOfWeek);
        parcel.writeTypedList(mSingleSatCorrectionList);
    }
@@ -154,9 +194,10 @@ public final class GnssMeasurementCorrections implements Parcelable {
         * GnssMeasurementCorrections}.
         */
        private double mLatitudeDegrees;

        private double mLongitudeDegrees;
        private double mAltitudeMeters;
        private double mHorizontalPositionUncertaintyMeters;
        private double mVerticalPositionUncertaintyMeters;
        private long mToaGpsNanosecondsOfWeek;
        private List<GnssSingleSatCorrection> mSingleSatCorrectionList;

@@ -181,6 +222,27 @@ public final class GnssMeasurementCorrections implements Parcelable {
            return this;
        }


        /**
         * Sets the horizontal uncertainty (68% confidence) in meters on the device position at
         * which the corrections are provided.
         */
        public Builder setHorizontalPositionUncertaintyMeters(
                double horizontalPositionUncertaintyMeters) {
            mHorizontalPositionUncertaintyMeters = horizontalPositionUncertaintyMeters;
            return this;
        }

        /**
         * Sets the vertical uncertainty (68% confidence) in meters on the device position at which
         * the corrections are provided.
         */
        public Builder setVerticalPositionUncertaintyMeters(
                double verticalPositionUncertaintyMeters) {
            mVerticalPositionUncertaintyMeters = verticalPositionUncertaintyMeters;
            return this;
        }

        /** Sets the time of applicability, GPS time of week in nanoseconds. */
        public Builder setToaGpsNanosecondsOfWeek(long toaGpsNanosecondsOfWeek) {
            mToaGpsNanosecondsOfWeek = toaGpsNanosecondsOfWeek;
+2 −2
Original line number Diff line number Diff line
@@ -317,8 +317,8 @@ public final class GnssSingleSatCorrection implements Parcelable {
         * between 0 and 1.
         */
        public Builder setProbSatIsLos(@FloatRange(from = 0f, to = 1f) float probSatIsLos) {
            Preconditions.checkArgumentInRange(probSatIsLos, 0, 1,
                    "probSatIsLos should be between 0 and 1.");
            Preconditions.checkArgumentInRange(
                    probSatIsLos, 0, 1, "probSatIsLos should be between 0 and 1.");
            mProbSatIsLos = probSatIsLos;
            mSingleSatCorrectionFlags =
                    (byte) (mSingleSatCorrectionFlags | HAS_PROB_SAT_IS_LOS_MASK);
+4 −0
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ public class GnssMeasurementCorrectionsTest extends TestCase {
        assertEquals(37.386051, measurementCorrections.getLatitudeDegrees());
        assertEquals(-122.083855, measurementCorrections.getLongitudeDegrees());
        assertEquals(32.0, measurementCorrections.getAltitudeMeters());
        assertEquals(9.25, measurementCorrections.getHorizontalPositionUncertaintyMeters());
        assertEquals(2.3, measurementCorrections.getVerticalPositionUncertaintyMeters());
        assertEquals(604000000000000L, measurementCorrections.getToaGpsNanosecondsOfWeek());

        GnssSingleSatCorrection singleSatCorrection =
@@ -74,6 +76,8 @@ public class GnssMeasurementCorrectionsTest extends TestCase {
                .setLatitudeDegrees(37.386051)
                .setLongitudeDegrees(-122.083855)
                .setAltitudeMeters(32)
                .setHorizontalPositionUncertaintyMeters(9.25)
                .setVerticalPositionUncertaintyMeters(2.3)
                .setToaGpsNanosecondsOfWeek(604000000000000L);
        List<GnssSingleSatCorrection> singleSatCorrectionList = new ArrayList<>();
        singleSatCorrectionList.add(GnssSingleSatCorrectionsTest.generateTestSingleSatCorrection());
+14 −0
Original line number Diff line number Diff line
@@ -73,6 +73,8 @@ static jmethodID method_reportGnssServiceDied;
static jmethodID method_correctionsGetLatitudeDegrees;
static jmethodID method_correctionsGetLongitudeDegrees;
static jmethodID method_correctionsGetAltitudeMeters;
static jmethodID method_correctionsGetHorPosUncMeters;
static jmethodID method_correctionsGetVerPosUncMeters;
static jmethodID method_correctionsGetToaGpsNanosecondsOfWeek;
static jmethodID method_correctionsGetSingleSatCorrectionList;
static jmethodID method_listSize;
@@ -2233,6 +2235,12 @@ static jboolean android_location_GnssMeasurementsProvider_inject_gnss_measuremen
        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");

@@ -2246,6 +2254,10 @@ static jboolean android_location_GnssMeasurementsProvider_inject_gnss_measuremen
        correctionsObj, method_correctionsGetLongitudeDegrees);
    jdouble altitudeDegreesCorr = env->CallDoubleMethod(
        correctionsObj, method_correctionsGetAltitudeMeters);
    jdouble horizontalPositionUncertaintyMeters = env->CallDoubleMethod(
        correctionsObj, method_correctionsGetHorPosUncMeters);
    jdouble verticalPositionUncertaintyMeters = env->CallDoubleMethod(
            correctionsObj, method_correctionsGetVerPosUncMeters);
    jlong toaGpsNanosOfWeek = env->CallLongMethod(
        correctionsObj, method_correctionsGetToaGpsNanosecondsOfWeek);
    jobject singleSatCorrectionList = env->CallObjectMethod(correctionsObj,
@@ -2348,6 +2360,8 @@ static jboolean android_location_GnssMeasurementsProvider_inject_gnss_measuremen
        .latitudeDegrees = latitudeDegreesCorr,
        .longitudeDegrees = longitudeDegreesCorr,
        .altitudeMeters = altitudeDegreesCorr,
        .horizontalPositionUncertaintyMeters = horizontalPositionUncertaintyMeters,
        .verticalPositionUncertaintyMeters = verticalPositionUncertaintyMeters,
        .toaGpsNanosecondsOfWeek = static_cast<uint64_t>(toaGpsNanosOfWeek),
        .satCorrections = list,
    };