summaryrefslogtreecommitdiff
path: root/location/java
diff options
context:
space:
mode:
author Shinru Han <shinruhan@google.com> 2021-02-25 13:51:58 +0800
committer Shinru Han <shinruhan@google.com> 2021-02-25 13:34:17 +0000
commitfa613735c48d878e3d0bea7fc076ea157d03e3be (patch)
tree0e69106f68b6a929f64ccd4d49e3e7a073160dbf /location/java
parentda74086ba4adbaab2ee38ed7aa65e6a2f2c27268 (diff)
Fix the return type of getFrequencyOffsetMetersPerSecond
CorrelationVector#getFrequencyOffestMetersPerSecond() should return double. Bug:179389247 Test: on cuttlefish Change-Id: I0a999915a0dccb06abb65af68105abd862c14708
Diffstat (limited to 'location/java')
-rw-r--r--location/java/android/location/CorrelationVector.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/location/java/android/location/CorrelationVector.java b/location/java/android/location/CorrelationVector.java
index eca35dd69362..4b6e6882b50a 100644
--- a/location/java/android/location/CorrelationVector.java
+++ b/location/java/android/location/CorrelationVector.java
@@ -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;
}