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

Commit fa613735 authored by Shinru Han's avatar Shinru Han
Browse files

Fix the return type of getFrequencyOffsetMetersPerSecond

CorrelationVector#getFrequencyOffestMetersPerSecond() should return double.

Bug:179389247
Test: on cuttlefish

Change-Id: I0a999915a0dccb06abb65af68105abd862c14708
parent da74086b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4288,7 +4288,7 @@ package android.location {
  public final class CorrelationVector implements android.os.Parcelable {
    method public int describeContents();
    method @IntRange(from=0) public int getFrequencyOffsetMetersPerSecond();
    method @FloatRange(from=0.0f) public double getFrequencyOffsetMetersPerSecond();
    method @NonNull public int[] getMagnitude();
    method @FloatRange(from=0.0f) public double getSamplingStartMeters();
    method @FloatRange(from=0.0f, fromInclusive=false) public double getSamplingWidthMeters();
@@ -4299,7 +4299,7 @@ package android.location {
  public static final class CorrelationVector.Builder {
    ctor public CorrelationVector.Builder();
    method @NonNull public android.location.CorrelationVector build();
    method @NonNull public android.location.CorrelationVector.Builder setFrequencyOffsetMetersPerSecond(@IntRange(from=0) int);
    method @NonNull public android.location.CorrelationVector.Builder setFrequencyOffsetMetersPerSecond(@FloatRange(from=0.0f) double);
    method @NonNull public android.location.CorrelationVector.Builder setMagnitude(@NonNull int[]);
    method @NonNull public android.location.CorrelationVector.Builder setSamplingStartMeters(@FloatRange(from=0.0f) double);
    method @NonNull public android.location.CorrelationVector.Builder setSamplingWidthMeters(@FloatRange(from=0.0f, fromInclusive=false) double);
+9 −10
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.location;

import android.annotation.FloatRange;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.os.Parcel;
@@ -39,7 +38,7 @@ public final class CorrelationVector implements Parcelable {

    private final double mSamplingWidthMeters;
    private final double mSamplingStartMeters;
    private final int mFrequencyOffsetMetersPerSecond;
    private final double mFrequencyOffsetMetersPerSecond;
    @NonNull private final int[] mMagnitude;

    /**
@@ -66,8 +65,8 @@ public final class CorrelationVector implements Parcelable {
    /**
     * Returns the frequency offset from reported pseudorange rate for this CorrelationVector.
     */
    @IntRange(from = 0)
    public int getFrequencyOffsetMetersPerSecond() {
    @FloatRange(from = 0.0f)
    public double getFrequencyOffsetMetersPerSecond() {
        return mFrequencyOffsetMetersPerSecond;
    }

@@ -88,7 +87,7 @@ public final class CorrelationVector implements Parcelable {
        Preconditions.checkNotNull(builder.mMagnitude, "Magnitude array must not be null");
        Preconditions.checkArgumentPositive(builder.mMagnitude.length,
                "Magnitude array must have non-zero length");
        Preconditions.checkArgumentNonNegative(builder.mFrequencyOffsetMetersPerSecond,
        Preconditions.checkArgument(builder.mFrequencyOffsetMetersPerSecond >= 0.0,
                "FrequencyOffsetMetersPerSecond must be non-negative (greater than or equal to 0)");
        Preconditions.checkArgument(builder.mSamplingWidthMeters > 0.0,
                "SamplingWidthMeters must be positive (greater than 0)");
@@ -103,7 +102,7 @@ public final class CorrelationVector implements Parcelable {
    private CorrelationVector(Parcel in) {
        mSamplingWidthMeters = in.readDouble();
        mSamplingStartMeters = in.readDouble();
        mFrequencyOffsetMetersPerSecond = in.readInt();
        mFrequencyOffsetMetersPerSecond = in.readDouble();
        mMagnitude = new int[in.readInt()];
        in.readIntArray(mMagnitude);
    }
@@ -144,7 +143,7 @@ public final class CorrelationVector implements Parcelable {
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeDouble(mSamplingWidthMeters);
        dest.writeDouble(mSamplingStartMeters);
        dest.writeInt(mFrequencyOffsetMetersPerSecond);
        dest.writeDouble(mFrequencyOffsetMetersPerSecond);
        dest.writeInt(mMagnitude.length);
        dest.writeIntArray(mMagnitude);
    }
@@ -165,7 +164,7 @@ public final class CorrelationVector implements Parcelable {
        return Arrays.equals(mMagnitude, c.getMagnitude())
                && Double.compare(mSamplingWidthMeters, c.getSamplingWidthMeters()) == 0
                && Double.compare(mSamplingStartMeters, c.getSamplingStartMeters()) == 0
                && Integer.compare(mFrequencyOffsetMetersPerSecond,
                && Double.compare(mFrequencyOffsetMetersPerSecond,
                        c.getFrequencyOffsetMetersPerSecond()) == 0;
    }

@@ -182,7 +181,7 @@ public final class CorrelationVector implements Parcelable {

        private double mSamplingWidthMeters;
        private double mSamplingStartMeters;
        private int mFrequencyOffsetMetersPerSecond;
        private double mFrequencyOffsetMetersPerSecond;
        @NonNull private int[] mMagnitude;

        /** Sets the space between correlation samples in meters. */
@@ -203,7 +202,7 @@ public final class CorrelationVector implements Parcelable {
        /** Sets the frequency offset from reported pseudorange rate for this CorrelationVector */
        @NonNull
        public Builder setFrequencyOffsetMetersPerSecond(
                @IntRange(from = 0) int frequencyOffsetMetersPerSecond) {
                @FloatRange(from = 0.0f) double frequencyOffsetMetersPerSecond) {
            mFrequencyOffsetMetersPerSecond = frequencyOffsetMetersPerSecond;
            return this;
        }
+1 −1
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ void GnssMeasurement_class_init_once(JNIEnv* env, jclass& clazz) {
                             "([I)Landroid/location/CorrelationVector$Builder;");
    method_correlationVectorBuilderSetFrequencyOffsetMetersPerSecond =
            env->GetMethodID(class_correlationVectorBuilder, "setFrequencyOffsetMetersPerSecond",
                             "(I)Landroid/location/CorrelationVector$Builder;");
                             "(D)Landroid/location/CorrelationVector$Builder;");
    method_correlationVectorBuilderSetSamplingStartMeters =
            env->GetMethodID(class_correlationVectorBuilder, "setSamplingStartMeters",
                             "(D)Landroid/location/CorrelationVector$Builder;");