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

Commit 4135b58f authored by Shinru Han's avatar Shinru Han
Browse files

Support toaSeconds in GnssSatelliteAlmanac

Test: atest CtsLocationNoneTestCases
Bug: 409934786
Bug: 358381377
Flag: android.location.flags.support_toa_in_gnss_satellite_almanac
Change-Id: I3314528ff6d5c0c4471524cc9ca434cb3c52da69
parent 3206178f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -487,6 +487,7 @@ package android.location {
    method @FloatRange(from=0.0f, to=8192.0f) public double getRootA();
    method @IntRange(from=0) public int getSvHealth();
    method @IntRange(from=1) public int getSvid();
    method @FlaggedApi("android.location.flags.support_toa_in_gnss_satellite_almanac") @IntRange(from=0, to=604800) public int getToaSeconds();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssAlmanac.GnssSatelliteAlmanac> CREATOR;
  }
@@ -505,6 +506,7 @@ package android.location {
    method @NonNull public android.location.GnssAlmanac.GnssSatelliteAlmanac.Builder setRootA(@FloatRange(from=0.0f, to=8192.0f) double);
    method @NonNull public android.location.GnssAlmanac.GnssSatelliteAlmanac.Builder setSvHealth(@IntRange(from=0) int);
    method @NonNull public android.location.GnssAlmanac.GnssSatelliteAlmanac.Builder setSvid(@IntRange(from=1) int);
    method @FlaggedApi("android.location.flags.support_toa_in_gnss_satellite_almanac") @NonNull public android.location.GnssAlmanac.GnssSatelliteAlmanac.Builder setToaSeconds(@IntRange(from=0, to=604800) int);
  }

  @FlaggedApi("android.location.flags.gnss_assistance_interface") public final class GnssAssistance implements android.os.Parcelable {
+37 −1
Original line number Diff line number Diff line
@@ -72,7 +72,13 @@ public final class GnssAlmanac implements Parcelable {
     */
    private final int mWeekNumber;

    /** Almanac reference time in seconds. */
    /**
     * Almanac reference time in seconds.
     *
     * <p> This is unused for Baidou.
     *
     * <p>For Beidou, each satellite has its own toaSeconds.
     */
    private final int mToaSeconds;

    /**
@@ -297,6 +303,15 @@ public final class GnssAlmanac implements Parcelable {
         */
        private final int mSvHealth;

        /**
         * Almanac reference time in seconds.
         *
         * <p> This is unused for GPS/QZSS/Galileo.
         *
         * <p>For Beidou, each satellite has its own toaSeconds.
         */
        private final int mToaSeconds;

        /** Eccentricity. */
        private final double mEccentricity;

@@ -339,6 +354,7 @@ public final class GnssAlmanac implements Parcelable {
        private GnssSatelliteAlmanac(Builder builder) {
            Preconditions.checkArgument(builder.mSvid > 0);
            Preconditions.checkArgument(builder.mSvHealth >= 0);
            Preconditions.checkArgumentInRange(builder.mToaSeconds, 0, 604800, "ToaSeconds");
            Preconditions.checkArgument(builder.mEccentricity >= 0.0f);
            Preconditions.checkArgumentInRange(builder.mInclination, -1.0f, 1.0f, "Inclination");
            Preconditions.checkArgumentInRange(builder.mOmega, -1.0f, 1.0f, "Omega");
@@ -350,6 +366,7 @@ public final class GnssAlmanac implements Parcelable {
            Preconditions.checkArgumentInRange(builder.mAf1, -1.5e-8f, 1.5e-8f, "Af1");
            mSvid = builder.mSvid;
            mSvHealth = builder.mSvHealth;
            mToaSeconds = builder.mToaSeconds;
            mEccentricity = builder.mEccentricity;
            mInclination = builder.mInclination;
            mOmega = builder.mOmega;
@@ -386,6 +403,13 @@ public final class GnssAlmanac implements Parcelable {
            return mSvHealth;
        }

        /** Returns the almanac reference time in seconds. */
        @FlaggedApi(Flags.FLAG_SUPPORT_TOA_IN_GNSS_SATELLITE_ALMANAC)
        @IntRange(from = 0, to = 604800)
        public int getToaSeconds() {
            return mToaSeconds;
        }

        /** Returns the eccentricity. */
        @FloatRange(from = 0.0f)
        public double getEccentricity() {
@@ -463,6 +487,7 @@ public final class GnssAlmanac implements Parcelable {
        public void writeToParcel(@NonNull Parcel dest, int flags) {
            dest.writeInt(mSvid);
            dest.writeInt(mSvHealth);
            dest.writeInt(mToaSeconds);
            dest.writeDouble(mEccentricity);
            dest.writeDouble(mInclination);
            dest.writeDouble(mOmega);
@@ -482,6 +507,7 @@ public final class GnssAlmanac implements Parcelable {
                                new Builder()
                                        .setSvid(in.readInt())
                                        .setSvHealth(in.readInt())
                                        .setToaSeconds(in.readInt())
                                        .setEccentricity(in.readDouble())
                                        .setInclination(in.readDouble())
                                        .setOmega(in.readDouble())
@@ -505,6 +531,7 @@ public final class GnssAlmanac implements Parcelable {
            StringBuilder builder = new StringBuilder("GnssSatelliteAlmanac[");
            builder.append("svid = ").append(mSvid);
            builder.append(", svHealth = ").append(mSvHealth);
            builder.append(", toaSeconds = ").append(mToaSeconds);
            builder.append(", eccentricity = ").append(mEccentricity);
            builder.append(", inclination = ").append(mInclination);
            builder.append(", omega = ").append(mOmega);
@@ -522,6 +549,7 @@ public final class GnssAlmanac implements Parcelable {
        public static final class Builder {
            private int mSvid;
            private int mSvHealth;
            private int mToaSeconds;
            private double mEccentricity;
            private double mInclination;
            private double mOmega;
@@ -559,6 +587,14 @@ public final class GnssAlmanac implements Parcelable {
                return this;
            }

            /** Sets the almanac reference time in seconds. */
            @FlaggedApi(Flags.FLAG_SUPPORT_TOA_IN_GNSS_SATELLITE_ALMANAC)
            @NonNull
            public Builder setToaSeconds(@IntRange(from = 0, to = 604800) int toaSeconds) {
                mToaSeconds = toaSeconds;
                return this;
            }

            /** Sets the eccentricity. */
            @NonNull
            public Builder setEccentricity(@FloatRange(from = 0.0f) double eccentricity) {
+7 −0
Original line number Diff line number Diff line
@@ -222,3 +222,10 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "support_toa_in_gnss_satellite_almanac"
    namespace: "location"
    description: "Support TOA in GnssSatelliteAlmanac"
    bug: "409934786"
}
+1 −1
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ cc_defaults {
        "android.hardware.broadcastradio@1.1",
        "android.hardware.contexthub@1.0",
        "android.hardware.common.fmq-V1-ndk",
        "android.hardware.gnss-V6-cpp",
        "android.hardware.gnss-V7-cpp",
        "android.hardware.gnss@1.0",
        "android.hardware.gnss@1.1",
        "android.hardware.gnss@2.0",
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ cc_defaults {
        "libnativehelper",
        "libhardware_legacy",
        "libutils",
        "android.hardware.gnss-V6-cpp",
        "android.hardware.gnss-V7-cpp",
        "android.hardware.gnss@1.0",
        "android.hardware.gnss@1.1",
        "android.hardware.gnss@2.0",
Loading