From 091f9b53f57637a4e362e43f9c04aa8f47144806 Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Fri, 25 Feb 2022 12:56:23 -0800 Subject: [PATCH] Append 'Seconds' to timeOfClock and timeOfEphemeris Bug: 219575003 Test: atest SatellitePvtTest Change-Id: I28d1e5b16db8b5f75015c54bcfcc391a6a50082b --- core/api/system-current.txt | 12 ++-- .../java/android/location/SatellitePvt.java | 67 ++++++++++--------- 2 files changed, 40 insertions(+), 39 deletions(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 414b2740350f9..213797e3412a6 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -5908,16 +5908,16 @@ package android.location { method @IntRange(from=0, to=1023) public int getIssueOfDataClock(); method @IntRange(from=0, to=255) public int getIssueOfDataEphemeris(); method @Nullable public android.location.SatellitePvt.PositionEcef getPositionEcef(); - method @IntRange(from=0) public long getTimeOfClock(); - method @IntRange(from=0) public long getTimeOfEphemeris(); + method @IntRange(from=0) public long getTimeOfClockSeconds(); + method @IntRange(from=0) public long getTimeOfEphemerisSeconds(); method @FloatRange public double getTropoDelayMeters(); method @Nullable public android.location.SatellitePvt.VelocityEcef getVelocityEcef(); method public boolean hasIono(); method public boolean hasIssueOfDataClock(); method public boolean hasIssueOfDataEphemeris(); method public boolean hasPositionVelocityClockInfo(); - method public boolean hasTimeOfClock(); - method public boolean hasTimeOfEphemeris(); + method public boolean hasTimeOfClockSeconds(); + method public boolean hasTimeOfEphemerisSeconds(); method public boolean hasTropo(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator CREATOR; @@ -5936,8 +5936,8 @@ package android.location { method @NonNull public android.location.SatellitePvt.Builder setIssueOfDataClock(@IntRange(from=0, to=1023) int); method @NonNull public android.location.SatellitePvt.Builder setIssueOfDataEphemeris(@IntRange(from=0, to=255) int); method @NonNull public android.location.SatellitePvt.Builder setPositionEcef(@NonNull android.location.SatellitePvt.PositionEcef); - method @NonNull public android.location.SatellitePvt.Builder setTimeOfClock(@IntRange(from=0) long); - method @NonNull public android.location.SatellitePvt.Builder setTimeOfEphemeris(@IntRange(from=0) int); + method @NonNull public android.location.SatellitePvt.Builder setTimeOfClockSeconds(@IntRange(from=0) long); + method @NonNull public android.location.SatellitePvt.Builder setTimeOfEphemerisSeconds(@IntRange(from=0) long); method @NonNull public android.location.SatellitePvt.Builder setTropoDelayMeters(@FloatRange(from=0.0f, to=100.0f) double); method @NonNull public android.location.SatellitePvt.Builder setVelocityEcef(@NonNull android.location.SatellitePvt.VelocityEcef); } diff --git a/location/java/android/location/SatellitePvt.java b/location/java/android/location/SatellitePvt.java index f140c68b19db6..f3e15084d7303 100644 --- a/location/java/android/location/SatellitePvt.java +++ b/location/java/android/location/SatellitePvt.java @@ -144,8 +144,8 @@ public final class SatellitePvt implements Parcelable { private final ClockInfo mClockInfo; private final double mIonoDelayMeters; private final double mTropoDelayMeters; - private final long mTimeOfClock; - private final long mTimeOfEphemeris; + private final long mTimeOfClockSeconds; + private final long mTimeOfEphemerisSeconds; private final int mIssueOfDataClock; private final int mIssueOfDataEphemeris; @EphemerisSource @@ -457,8 +457,8 @@ public final class SatellitePvt implements Parcelable { @Nullable ClockInfo clockInfo, double ionoDelayMeters, double tropoDelayMeters, - long timeOfClock, - long timeOfEphemeris, + long timeOfClockSeconds, + long timeOfEphemerisSeconds, int issueOfDataClock, int issueOfDataEphemeris, @EphemerisSource int ephemerisSource) { @@ -468,8 +468,8 @@ public final class SatellitePvt implements Parcelable { mClockInfo = clockInfo; mIonoDelayMeters = ionoDelayMeters; mTropoDelayMeters = tropoDelayMeters; - mTimeOfClock = timeOfClock; - mTimeOfEphemeris = timeOfEphemeris; + mTimeOfClockSeconds = timeOfClockSeconds; + mTimeOfEphemerisSeconds = timeOfEphemerisSeconds; mIssueOfDataClock = issueOfDataClock; mIssueOfDataEphemeris = issueOfDataEphemeris; mEphemerisSource = ephemerisSource; @@ -545,31 +545,31 @@ public final class SatellitePvt implements Parcelable { } /** - * Time of Clock. + * Time of Clock in seconds. * *

The value is in seconds since GPS epoch, regardless of the constellation. * *

The value is not encoded as in GPS ICD200 documentation. * - *

This field is valid if {@link #hasTimeOfClock()} is true. + *

This field is valid if {@link #hasTimeOfClockSeconds()} is true. */ @IntRange(from = 0) - public long getTimeOfClock() { - return mTimeOfClock; + public long getTimeOfClockSeconds() { + return mTimeOfClockSeconds; } /** - * Time of ephemeris. + * Time of ephemeris in seconds. * *

The value is in seconds since GPS epoch, regardless of the constellation. * *

The value is not encoded as in GPS ICD200 documentation. * - *

This field is valid if {@link #hasTimeOfEphemeris()} is true. + *

This field is valid if {@link #hasTimeOfEphemerisSeconds()} is true. */ @IntRange(from = 0) - public long getTimeOfEphemeris() { - return mTimeOfEphemeris; + public long getTimeOfEphemerisSeconds() { + return mTimeOfEphemerisSeconds; } /** @@ -607,13 +607,13 @@ public final class SatellitePvt implements Parcelable { return (mFlags & HAS_ISSUE_OF_DATA_EPHEMERIS) != 0; } - /** Returns {@code true} if {@link #getTimeOfClock()} ()} is valid. */ - public boolean hasTimeOfClock() { + /** Returns {@code true} if {@link #getTimeOfClockSeconds()} ()} is valid. */ + public boolean hasTimeOfClockSeconds() { return (mFlags & HAS_TIME_OF_CLOCK) != 0; } - /** Returns {@code true} if {@link #getTimeOfEphemeris()} is valid. */ - public boolean hasTimeOfEphemeris() { + /** Returns {@code true} if {@link #getTimeOfEphemerisSeconds()} is valid. */ + public boolean hasTimeOfEphemerisSeconds() { return (mFlags & HAS_TIME_OF_EPHEMERIS) != 0; } @@ -671,8 +671,8 @@ public final class SatellitePvt implements Parcelable { parcel.writeParcelable(mClockInfo, flags); parcel.writeDouble(mIonoDelayMeters); parcel.writeDouble(mTropoDelayMeters); - parcel.writeLong(mTimeOfClock); - parcel.writeLong(mTimeOfEphemeris); + parcel.writeLong(mTimeOfClockSeconds); + parcel.writeLong(mTimeOfEphemerisSeconds); parcel.writeInt(mIssueOfDataClock); parcel.writeInt(mIssueOfDataEphemeris); parcel.writeInt(mEphemerisSource); @@ -687,8 +687,8 @@ public final class SatellitePvt implements Parcelable { + ", ClockInfo=" + mClockInfo + ", IonoDelayMeters=" + mIonoDelayMeters + ", TropoDelayMeters=" + mTropoDelayMeters - + ", TimeOfClock=" + mTimeOfClock - + ", TimeOfEphemeris=" + mTimeOfEphemeris + + ", TimeOfClockSeconds=" + mTimeOfClockSeconds + + ", TimeOfEphemerisSeconds=" + mTimeOfEphemerisSeconds + ", IssueOfDataClock=" + mIssueOfDataClock + ", IssueOfDataEphemeris=" + mIssueOfDataEphemeris + ", EphemerisSource=" + mEphemerisSource @@ -709,8 +709,8 @@ public final class SatellitePvt implements Parcelable { @Nullable private ClockInfo mClockInfo; private double mIonoDelayMeters; private double mTropoDelayMeters; - private long mTimeOfClock; - private long mTimeOfEphemeris; + private long mTimeOfClockSeconds; + private long mTimeOfEphemerisSeconds; private int mIssueOfDataClock; private int mIssueOfDataEphemeris; @EphemerisSource @@ -796,13 +796,13 @@ public final class SatellitePvt implements Parcelable { * *

The value is not encoded as in GPS ICD200 documentation. * - * @param timeOfClock time of clock (seconds) + * @param timeOfClockSeconds time of clock (seconds) * @return builder object */ @NonNull - public Builder setTimeOfClock(@IntRange(from = 0) long timeOfClock) { - Preconditions.checkArgumentNonnegative(timeOfClock); - mTimeOfClock = timeOfClock; + public Builder setTimeOfClockSeconds(@IntRange(from = 0) long timeOfClockSeconds) { + Preconditions.checkArgumentNonnegative(timeOfClockSeconds); + mTimeOfClockSeconds = timeOfClockSeconds; mFlags = (byte) (mFlags | HAS_TIME_OF_CLOCK); return this; } @@ -814,13 +814,13 @@ public final class SatellitePvt implements Parcelable { * *

The value is not encoded as in GPS ICD200 documentation. * - * @param timeOfEphemeris time of ephemeris (seconds) + * @param timeOfEphemerisSeconds time of ephemeris (seconds) * @return builder object */ @NonNull - public Builder setTimeOfEphemeris(@IntRange(from = 0) int timeOfEphemeris) { - Preconditions.checkArgumentNonnegative(timeOfEphemeris); - mTimeOfEphemeris = timeOfEphemeris; + public Builder setTimeOfEphemerisSeconds(@IntRange(from = 0) long timeOfEphemerisSeconds) { + Preconditions.checkArgumentNonnegative(timeOfEphemerisSeconds); + mTimeOfEphemerisSeconds = timeOfEphemerisSeconds; mFlags = (byte) (mFlags | HAS_TIME_OF_EPHEMERIS); return this; } @@ -879,7 +879,8 @@ public final class SatellitePvt implements Parcelable { @NonNull public SatellitePvt build() { return new SatellitePvt(mFlags, mPositionEcef, mVelocityEcef, mClockInfo, - mIonoDelayMeters, mTropoDelayMeters, mTimeOfClock, mTimeOfEphemeris, + mIonoDelayMeters, mTropoDelayMeters, mTimeOfClockSeconds, + mTimeOfEphemerisSeconds, mIssueOfDataClock, mIssueOfDataEphemeris, mEphemerisSource); }