summaryrefslogtreecommitdiff
path: root/location
diff options
context:
space:
mode:
authorJoe Huang <joethhuang@google.com>2021-05-21 17:46:09 +0800
committerJoe Huang <joethhuang@google.com>2021-05-22 02:02:53 +0800
commit8945fbb3a19f541b65abdacca773994871aaceb1 (patch)
treef1058b76f2990021e13850bdbd4d950ca10f50b9 /location
parentea1518faf14a57b58da5f0648810b26b770e638b (diff)
SatellitePvt API council review
Remove getFlags/setFlags, determining the flag in Java side Bug: 188798284 Test: atest CtsLocationPrivilegedTestCases, also try setting different flags in HAL to see if CTS can be passed. Change-Id: I231148b62404ee4873da60546eebb75d83fae9a7
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;
}