summaryrefslogtreecommitdiff
path: root/location
diff options
context:
space:
mode:
authorJoe Huang <joethhuang@google.com>2021-05-22 04:46:24 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-05-22 04:46:24 +0000
commit9d78bec9fa341d34a9bfe39ad892365cf1703189 (patch)
treea2c44b8cb76da836a09996524c5d48dd2a1acc6d /location
parent20b934e7dbe340e1eeb5b551af34766a4f9e8295 (diff)
parent8945fbb3a19f541b65abdacca773994871aaceb1 (diff)
Merge "SatellitePvt API council review" into sc-dev
Diffstat (limited to 'location')
-rw-r--r--location/java/android/location/SatellitePvt.java36
1 files changed, 15 insertions, 21 deletions
diff --git a/location/java/android/location/SatellitePvt.java b/location/java/android/location/SatellitePvt.java
index bb9ae6e661ef..794a8d0731f9 100644
--- a/location/java/android/location/SatellitePvt.java
+++ b/location/java/android/location/SatellitePvt.java
@@ -399,13 +399,6 @@ public final class SatellitePvt implements Parcelable {
}
/**
- * Gets a bitmask of fields present in this object
- */
- public int getFlags() {
- return mFlags;
- }
-
- /**
* Returns a {@link PositionEcef} object that contains estimates of the satellite
* position fields in ECEF coordinate frame.
*/
@@ -536,18 +529,6 @@ public final class SatellitePvt implements Parcelable {
private double mTropoDelayMeters;
/**
- * Sets a bitmask of fields present in this object
- *
- * @param flags int flags
- * @return Builder builder object
- */
- @NonNull
- public Builder setFlags(int flags) {
- mFlags = flags;
- return this;
- }
-
- /**
* Set position ECEF.
*
* @param positionEcef position ECEF object
@@ -557,6 +538,7 @@ public final class SatellitePvt implements Parcelable {
public Builder setPositionEcef(
@NonNull PositionEcef positionEcef) {
mPositionEcef = positionEcef;
+ updateFlags();
return this;
}
@@ -570,6 +552,7 @@ public final class SatellitePvt implements Parcelable {
public Builder setVelocityEcef(
@NonNull VelocityEcef velocityEcef) {
mVelocityEcef = velocityEcef;
+ updateFlags();
return this;
}
@@ -583,9 +566,16 @@ public final class SatellitePvt implements Parcelable {
public Builder setClockInfo(
@NonNull ClockInfo clockInfo) {
mClockInfo = clockInfo;
+ updateFlags();
return this;
}
+ private void updateFlags() {
+ if (mPositionEcef != null && mVelocityEcef != null && mClockInfo != null) {
+ mFlags = (byte) (mFlags | HAS_POSITION_VELOCITY_CLOCK_INFO);
+ }
+ }
+
/**
* Set ionospheric delay in meters.
*
@@ -593,8 +583,10 @@ public final class SatellitePvt implements Parcelable {
* @return Builder builder object
*/
@NonNull
- public Builder setIonoDelayMeters(@FloatRange() double ionoDelayMeters) {
+ public Builder setIonoDelayMeters(
+ @FloatRange(from = 0.0f, to = 100.0f) double ionoDelayMeters) {
mIonoDelayMeters = ionoDelayMeters;
+ mFlags = (byte) (mFlags | HAS_IONO);
return this;
}
@@ -605,8 +597,10 @@ public final class SatellitePvt implements Parcelable {
* @return Builder builder object
*/
@NonNull
- public Builder setTropoDelayMeters(@FloatRange() double tropoDelayMeters) {
+ public Builder setTropoDelayMeters(
+ @FloatRange(from = 0.0f, to = 100.0f) double tropoDelayMeters) {
mTropoDelayMeters = tropoDelayMeters;
+ mFlags = (byte) (mFlags | HAS_TROPO);
return this;
}